I have a demo file: test.py. In the Windows Console I can run the file with: C:>test.py
test.py
C:>test.py
How can I execute the file in the Python Shell instead?
Use execfile for Python 2:
>>> execfile('C:\test.py')
Use exec for Python 3
>>> exec(open("C:\test.py").read())
2.1m questions
2.1m answers
60 comments
57.0k users