I'm trying to print horizontally not having any luck. I need to print
I#x where x one through the length of a list i.e.-I#1 I#2 I#3 I#4 etc. This is what I have which is syntactically wrong:

for x in range(1, len(depend)):
    print "%05s" ('I#'+str(x))

Could someone please point me in the right direction.

8 Years
Discussion Span
Last Post by nizbit

We can fix that with one character, a lowly comma :)
If you put the comma after the print statement it should work

for x in range(1, len(depend)):
   #comma after the whole statement
    print "%05s" % ('I#'+str(x)),

hope that helps

EDIT: Also you need to have the percentage sign after the quotation marks to make the string formatting work properly, i put that in the code already though

Edited by Paul Thompson: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.