![]() |
python, os.system() function. howto use python variables?
i would like to do something like this in python:
Code:
myCoolVariable="some_string"Thank you, Jameson |
It needs to be one of these forms:
Code:
>>> os.system('echo "asdg"') |
That is just printing out the string literals you are passing to echo - i am looking to resolve the python varaible myCoolVariable before the execution of echo in the sysem() call.
For example, I would like: Code:
$ pythonCode:
potatoCode:
hamburger=os.system('echo $MY_SHELL_VAR | sed "s/longsed/replacement/g"') |
Bingo!!!
Code:
>>> string="python is cool" |
Thanks pixellany!
|
Or do string interpolation:
Code:
bash$ python |
| All times are GMT -5. The time now is 07:40 AM. |