What OS are you using. I'm not sure about anything else but on a mac
it's:
[color=blue][color=green]
>>import os
>>os.system(" ls -la")[/color][/color]
What OS are you using. I'm not sure about anything else but on a mac
it's:
[color=blue][color=green]
>>import os
>>os.system(" ls -la")[/color][/color]
Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace seve...
:::
also note that you shouldn't use external commands for trivial things like
getting a list of files or getting the size of a file; you can get a list of all
files in a directory with
files = os.listdir(dire ctory)
for file in files:
file = os.path.join(di rectory, file) # full path
...
or
files = glob.glob(patte rn)
for file in files:
...
and you can get information about a given file with
Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace seve...
:::
also note that you shouldn't use external commands for trivial things like
getting a list of files or getting the size of a file; you can get a list of all
files in a directory with
files = os.listdir(dire ctory)
for file in files:
file = os.path.join(di rectory, file) # full path
...
or
files = glob.glob(patte rn)
for file in files:
...
and you can get information about a given file with
On Mon, 21 Nov 2005 19:39:42 -0500, Peter Hansen <peter@engcorp. com> wrote:
[color=blue]
>amfr wrote:[color=green]
>> Thanks for your help. Another question, is there an built in md5/sha1
>> function in python?[/color]
>
>Yes.
>
>Although it's a long list, it is worthwhile as a newbie for one to
>peruse the list of standard modules from time to time, until you gain a
>familiarity with what is there.
>
>http://docs.python.org/modindex.html
>[/color]
Worthwhile as oldbies too ;-)
Comment