Using os.system() and string concatenation

Wayne Witzel III wwitzel3 at gmail.com
Tue Oct 12 14:43:28 EDT 2004


Using Python 2.3

Currently I process three files and build the output of those files in
to lists using for statements.

I think take those lists and provide them to an os.system() call.

cmd = "/usr/sbin/useradd"
os.system(cmd + list1[0] + list1[1] + list2[0] + list3[0])

This executes without any errors, but doesn't execute the command
supplied to os.system(). Now if I place them all in cmd first, then
supply it to os.system() it executes just fine. So there really isn't
a problem, just wanting to know what would cause such behavior.

Thanks,

Wayne



More information about the Python-list mailing list