Re: write a .txt file

2010-07-13 Thread MRAB
Jia Hu wrote: On Tue, Jul 13, 2010 at 3:17 AM, Cameron Simpson > wrote: On 13Jul2010 02:46, Jia Hu mailto:huji...@gmail.com>> wrote: | Hi: | | Do you mean the following code? | | #!/usr/bin/python | # OS: Ubuntu | import subprocess |

Re: write a .txt file

2010-07-13 Thread Jia Hu
On Tue, Jul 13, 2010 at 3:17 AM, Cameron Simpson wrote: > On 13Jul2010 02:46, Jia Hu wrote: > | Hi: > | > | Do you mean the following code? > | > | #!/usr/bin/python > | # OS: Ubuntu > | import subprocess > | fileName = open ('final.txt', 'a') > | fileName.write ('%s %s %s \n' % (12,25,9)) > | >

Re: write a .txt file

2010-07-13 Thread Cameron Simpson
On 13Jul2010 02:46, Jia Hu wrote: | Hi: | | Do you mean the following code? | | #!/usr/bin/python | # OS: Ubuntu | import subprocess | fileName = open ('final.txt', 'a') | fileName.write ('%s %s %s \n' % (12,25,9)) | | fileName.flush() # add | fileName.close() # add You should not need the

Re: write a .txt file

2010-07-12 Thread Jia Hu
Hi: Do you mean the following code? #!/usr/bin/python # OS: Ubuntu import subprocess fileName = open ('final.txt', 'a') fileName.write ('%s %s %s \n' % (12,25,9)) fileName.flush() # add fileName.close() # add desLrr = subprocess.Popen('ls -a >> final.txt', shell=True) # change to "ls -a" fi

Re: write a .txt file

2010-07-12 Thread Cameron Simpson
On 12Jul2010 21:28, Jia Hu wrote: | I have a problem about how to generate a specific.txt file. I use the | following code: | | #!/usr/bin/python | # OS: Ubuntu | import subprocess | fileName = open ('final.txt', 'a') | fileName.write ('%s %s %s \n' % (12,25,9)) String still in Python's buffer,

Re: write a .txt file

2010-07-12 Thread Jia Hu
If I change "'echo "hello">> final.txt" to "ls -a >> final.txt" and add fileName.close() before subprocess. The result is still like: 12 25 9 85 25 12 # list of files . How can I put the list before the number list 85 25 12? Thank you. On Tue, Jul 13, 2010 at 12:47 AM, Jia Hu wrote:

Re: write a .txt file

2010-07-12 Thread MRAB
Jia Hu wrote: Hello: I have a problem about how to generate a specific.txt file. I use the following code: #!/usr/bin/python # OS: Ubuntu import subprocess fileName = open ('final.txt', 'a') fileName.write ('%s %s %s \n' % (12,25,9)) desLrr = subprocess.Popen('echo "hello" >> final.txt ', s

write a .txt file

2010-07-12 Thread Jia Hu
Hello: I have a problem about how to generate a specific.txt file. I use the following code: #!/usr/bin/python # OS: Ubuntu import subprocess fileName = open ('final.txt', 'a') fileName.write ('%s %s %s \n' % (12,25,9)) desLrr = subprocess.Popen('echo "hello" >> final.txt ', shell=True) fileName