Issue
I have a python file and within that file I want to start an interpreter within that context. Is that possible?
I'm currently starting an interpreter and then using exec
to load in the file, but it would be quicker and easier to do it the other way around.
The use case is loading in a file full of data and helper functions that I then want to play around with in the interpreter.
Solution
-i
flag when running Python interpreter makes you stay in the interpreter after script finishes running.
python -i file.py
Answered By - matszwecja
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.