Computing.Net > Forums > Programming > Python: call variables in os.system

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Python: call variables in os.system

Reply to Message Icon

Name: Six
Date: September 1, 2003 at 09:14:02 Pacific
OS: Slackware
CPU/Ram: 1.3 512
Comment:

Hi, I am new to Python and have an interactive script going. I can't figure out how to get a variable passed to an outside command with os.system module. example:

dir = "/home/test"
os.system('ls $dir')

the ls command works, jut can't find $dir. just plain dir without $ doesn't work.

thanks



Sponsored Link
Ads by Google

Response Number 1
Name: talha
Date: September 4, 2003 at 18:29:28 Pacific
Reply:

os.system( 'ls ' + dir )


0
Reply to Message Icon

Related Posts

See More


Is possible to decompiler... Degree year project - ide...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Python: call variables in os.system

System Environment Variables in VB www.computing.net/answers/programming/system-environment-variables-in-vb/12819.html

store system() call rslt in string www.computing.net/answers/programming/store-system-call-rslt-in-string/18619.html

setting environment variables in vb www.computing.net/answers/programming/setting-environment-variables-in-vb/13145.html