How to make a script execute just after python shell starts and before customuer's input?
Question: In Pythonxy I can edit some python scripts in an pre-defined folder so that
they will be executed (or import? I don't know). For example, if I put a
script in that folder:

    
    
    import numpy as np
    import scipy as sp
    

Then after I enter python shell, I can conveniently use np and sp as quick
references.

Now the problem is, how can I use such technique without Pythonxy's support in
standard python shell? Can I write a script to handle pre import? I think it
will be very useful.


Answer: You can do this by setting up a python startup file, and set `PYTHONSTARTUP`
variable to that file. In the startup file, just write

    
    
    import numpy as np
    import scipy as sp
    

Then, every time you enter python shell, it will automatically import the
above modules.

Here is an example. [Installing pythonstartup
file](http://stackoverflow.com/questions/5837259/installing-pythonstartup-
file)

