Issue
How can I get something like Spyder's runfile
function in IPython? (I'm using IPython v. 4.1.2 under Python 2.7.9.)
Solution
Python files can be executed within the IPython environment using the magic command %run
.
Example:
print_time.py
# #!/usr/bin/python
#
# from datetime import datetime
#
# print "The current time is {}".format(datetime.now().strftime("%H:%M:%S"))
In [1]: %run print_time.py
The current time is 21:37:46
More information on how to run files outside your working directory can be found in this answer.
Answered By - cmaher
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.