[Tutor] lists

Norman Khine norman at khine.net
Tue Jan 20 17:30:19 CET 2009


Hi
What am I doing wrong

 >>> media_list = ['upper_b.wav', 'upper_a.wav']
 >>> print '%s' % (for x in media_list)
   File "<stdin>", line 1
     print '%s' % (for x in media_list)
                     ^
SyntaxError: invalid syntax
 >>> print '%s' % (x for x in media_list)
<generator object at 0x532210>

I want to replace %s with the items of the list as individual item 
string, i.e

'upper_b.wav', 'upper_a.wav'

if I change the list to string

I still get one item:

"'upper_b.wav', 'upper_a.wav'"

thanks
norman


More information about the Tutor mailing list