Re: os.system question
- From: kyosohma@xxxxxxxxx
- Date: Fri, 28 Dec 2007 11:14:24 -0800 (PST)
On Dec 28, 12:57 pm, stanleyxu <no_re...@xxxxxxxxxxxxx> wrote:
To note this problem occurs when debugging script in IDLE editor.
When I double click on my_script.py, all outputs will be printed in one
console.
--
___
oo // \\
(_,\/ \_/ \ Xu, Qian
\ \_/_\_/> stanleyxu2005
/_/ \_\
Why are you using os.system for these commands in the first place? You
should be using the os and shutil modules instead as they would be
more cross-platform friendly.
Something like this:
# untested
for new_folder, old_folder in folder_array:
os.mkdir(new_folder)
shutil.copytree(old_folder, new_folder)
Adjust the path as needed in the mkdir call.
See shutil's docs for more info:
http://docs.python.org/lib/module-shutil.html
And here's some folder manipulation docs:
http://effbot.org/librarybook/os.htm
By the by, the subprocess module is supposed to be used in place of
the os.system and os.popen* calls: http://docs.python.org/lib/module-subprocess.html
Mike
.
- Follow-Ups:
- Re: os.system question
- From: stanleyxu
- Re: os.system question
- References:
- os.system question
- From: stanleyxu
- Re: os.system question
- From: stanleyxu
- os.system question
- Prev by Date: Re: Cheat ***
- Next by Date: Re: Remove namespace declaration from ElementTree in lxml
- Previous by thread: Re: os.system question
- Next by thread: Re: os.system question
- Index(es):