[Tutor] DOS Commands?

Magnus Lycka magnus@thinkware.se
Fri Nov 8 08:23:01 2002


At 13:04 2002-11-08 +0000, James.Rocks@equant.com wrote:
>      from time import *

A style issue. "from ??? import *" is usually a bad thing.
It's been discussed before, see archives.

>       popen('ncftpput -u ****** -p ****** ******.lon.globalone.net sms %s'
>% sSMSFile, 'w')

This opens a pipe, which is like a file handle. Nothing
happens until you read it.

You want os.system, not os.popen, if you don't plan
to use what the OS command puts on stdout.

os.popen can be used like this:

import os

text = os.popen('ls -l').readlines()
for row in text:
     print row,


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se