[Tutor] Linux variable to Python
Max Noel
maxnoel_fr at yahoo.fr
Fri May 13 22:20:20 CEST 2005
On May 13, 2005, at 21:03, Alberto Troiano wrote:
>>>> os.system("fec=cam`date +%Y%m%d%H%M%S`.jpg")
>>>>
> 0
>
>>>> os.system("echo $fec")
>>>>
> 0
>
>>>> os.system("mv hola.txt grabacion/$fec")
>>>>
> 0
>
> Then I check for the file and turns out that it moved hola.txt to
> grabacion
> with the same name
> I think that for some extrange way it is not accepting the linux
> variable
>
No, it's just that the os.system() function returns the return
value of the executed process (that is, 0 if everything went okay).
For what you want to do, one of the os.popen* functions is what
you're looking for.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge
a perfect, immortal machine?"
More information about the Tutor
mailing list