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.

Recommended Answers

All 2 Replies

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

Thats awesome!! That helps a lot. Thanks!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.