Using os.system() and string concatenation

Steven Bethard steven.bethard at gmail.com
Tue Oct 12 16:15:57 EDT 2004


Wayne Witzel III <wwitzel3 <at> gmail.com> writes:

> No, I was properly inserting the spaces. When I changed it to a print
> statement and executed the resulting output, it worked just fine.

Not sure if I understand exactly what you said here, but just to be clear, the 
print statement inserts spaces:

>>> x, y, z = 'x', 'y', 'z'
>>> print x, y, z
x y z
>>> x + y + z
'xyz'
>>> print x + y + z
xyz
>>> import sys
>>> sys.stdout.write(x + y + z)
xyz

So if you're saying the output of a print statement works, but the string 
concatenation doesn't then yes, it does sound like you're not inserting spaces.

Could you put

print cmd + list1[0] + list1[1] + list2[0] + list3[0]

at the end of your script and tell us what it outputs?

Steve






More information about the Python-list mailing list