Sign in to follow this  
BakedSasquatch

Importing Modules in Python Help

Recommended Posts

BakedSasquatch    122
Hello, I am currently a few chapters into Learning Python by Mark Lutz, and I need a quick question answered. Right now it says "For instance, if you start an interactive session (in IDLE, from a command prompt, or otherwise), you can run the script4.py file you created earlier with a simple import. Then under this it says: D:\LP3E\Examples> c:\python25\python >>> import script4 win32 a bunch of random numbers go here from the 2 ** 100 in the code _________________________________________________________________ I am not sure what the author means and how I go about importing the script in IDLE. Thank you for any help.

Share this post


Link to post
Share on other sites
SiCrane    11839
Save the python into a file named script4.py in a directory on your python path. For example, with a default installation of Python 2.5 on Windows you can save it into C:\Python25. Open IDLE. Type "import script4". It will then open and run the contents of script4.py.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this