Iam using pycharm and would like to use some variables I want to input at the terminal.
However I cant seem to run a script for the Python terminal in my pyCharm. I have the script called "sample.py" but if try "sample.py", "python sample.py" or "!python sample.py" I do not get the script working. I get something like:
>>>test5.py
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'test5' is not defined
Could anybody tell me how I can trigger a script in the python terminal in Pycharm?
1) use import
>>> import test5
2) use exec()
>>> exec(open("test5.py").read())
I don't know if this are the right approaches to handle this problem...
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments