Windows 7 As I'm learning Python (3.2) I prefer using IDLE than CMD. In order to change the path where I can import scripts of my own, I use a little trick that I found in this site: I go FILE>OPEN>directory>myscript and then run it and from then on I'm on this directory.
Nevertheless, I wonder whether there is a simple command, like CD... to move to the correct directory, without using tricks.
Thank you,
http://www.skylit.com/python/Appendix-A.html
Check section A.2, just before section A.3:
>>> from os import chdir
>>> chdir("C:/myOtherWork")
And also to check the working directory:
>>> from os.path import abspath
>>> abspath('.')
If the current directory is not already in the path you need to add it:
>>> import sys
>>> sys.path.append('.')
精彩评论