I am trying to make a MS-DOS like program like python. I am adding a system to see if a command exists. the file "known.txt" contains:

['catfish', 'cls', 'dl', 'hello', 'help', 'help1', 'help2', 'info', 'logout', 'ping', 'run', 'stop', 'time']

This is the code i am using to run it:

if pnt in open('known.txt').read():
        sys.path.insert('F:/Term/commands/')
        answermodule = importlib.import_module(cmd)

but when i run it, i get this:
TypeError: 'in <string>' requires string as left operand, not tuple

how could i fix this?

Some code is missing, I get

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
 NameError: name 'pnt' is not defined

please post the code that generates your error message, plus full traceback.

i actually found a mistake in my code!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.