You are not logged in.
Hi, i have a little doubt. For example. i write:
import os
os.system('whereis lmms')
And that returns:
lmms: /usr/bin/lmms /usr/lib/lmms /usr/include/lmms /usr/share/lmms /usr/share/man/man1/lmms.1.gz
And i want to save all that paths into diferent variables, so i get something like this:
a= '/usr/bin/lmms'
b = '/usr/lib/lmms'
c = '/usr/include/lmms'
d = '/usr/share/lmms'
e = '/usr/share/man/man1/lmms.1.gz'
Last edited by B4RR13N705 (2009-08-26 17:52:40)
OS -----> Arch Linux DE -----> KDE4
CPU ---> 2.66GHz RAM ---> 512 MB
SWAP -> 2 G / -------> 10 G
/home -> 50 G /boot ---> 64 MB
Offline
Something like this should do it:
cmd = os.popen('whereis lmms')
lmms = cmd.read() #Get the output as a string.
cmd.close()
lmms = lmms.split() #Split the output at each space. Creates a list.
lmms = lmms[1:] #Removes the lmms: bit at the beginning.
You can access each path now by using lmms[0], lmms[1] etc. You should look into using the subprocess module instead, though - this method is deprecated.
Last edited by Crows (2009-08-26 18:10:33)
Offline