How to do it...

  1. To read an additional startup file from the current directory, the following example command shows how to code it in the global startup file (read_startup.py):
        if os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read()
  1. While the startup file is only looked at for interactive mode, it can be referenced within a script. startup_script.py shows how to do this:
      import os
filename = os.environ.get('PYTHONSTARTUP')
if filename and os.path.isfile(filename):
with open(filename) as fobj:
startup_file = fobj.read()
exec(startup_file)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset