window opens with os.system()

Gabriel Genellina gagsl-py at yahoo.com.ar
Sun Feb 18 17:27:17 EST 2007


En Sun, 18 Feb 2007 18:09:23 -0300, jim-on-linux <inq1ltd at verizon.net>  
escribió:

> I have a simple module that sends text files to a
> printer. Then, it moves the file to the 'Fprtd'
> directory. The module contains the following
> code;
>
>
> #####
>
> for n in PrtList:
>   os.system('type '+n+ ' > prn'
>   os.system('move '+n+ ' Fprtd')
>
> #####
>
> os.system opens and closes a window for each file
> it sends to the printer and again for each time
> it moves a file to the Fprtd directory.  If there
> were only a few files, this wouldn't be so bad.
> But, when the files number 300 to 400 it becomes
> objectionable.

Just code the above in Python itself.
type xxx > prn == copy xxx prn == shutil.copyfile(xxx,prn)
move xxx Fprtd == shutil.move(xxx, Fprtd)

-- 
Gabriel Genellina




More information about the Python-list mailing list