Standard Library, Brief Tour, os.system() example, small nit
http://docs.python.org/tutorial/stdlib.html In section 10.1, Operating System Interface, I have a small nit with the first example for os.system. First it doesn't mention what os.system does, Second the example command is DOS/Windows specific, Third, if run it will change the current time on your DOS/Windows machine. I think that example could easily by improved. My suggestions for a command that I think will work under Windows, *nix, and OS X, are either 'mkdir' or 'set' to get a list of environment variables. Currently the example text is:
import os os.system('time 0:02') 0 os.getcwd() # Return the current working directory 'C:\\Python26' os.chdir('/server/accesslogs')
My suggestion is:
import os os.getcwd() # Return the current working directory 'C:\\Python26' os.chdir('/server/accesslogs') # Change current working directory os.system('mkdir today') # Run the command mkdir in the system shell 0
Alternate
os.system('set') # Run the command set in the system shell <displays a list of environment variables>
Thanks, --Rob
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 25.10.2010 16:14, schrieb Robert Terzi:
http://docs.python.org/tutorial/stdlib.html
In section 10.1, Operating System Interface, I have a small nit with the first example for os.system. First it doesn't mention what os.system does, Second the example command is DOS/Windows specific, Third, if run it will change the current time on your DOS/Windows machine.
I think that example could easily by improved. My suggestions for a command that I think will work under Windows, *nix, and OS X, are either 'mkdir' or 'set' to get a list of environment variables.
Hi Robert, thanks for your suggestion; this is now changed to your alternate version in the developer docs. regards, Georg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzvpDwACgkQN9GcIYhpnLA53gCffvwwmyevjIYd6fGc4HWPpdOh +wAAmwVFQeex91EaXKxKzGYRbgH23cXw =kwVx -----END PGP SIGNATURE-----
participants (2)
-
Georg Brandl
-
Robert Terzi