Jump to content
  • Advertisement
Sign in to follow this  
BakedSasquatch

Importing Modules in Python Help

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!