I have been working on something, and i'm stuck again...
I have to print out an infile list in columns, and then print it out again in alphabetical order(sort). I can't figure how to print in columns, nor can i soft it. Any help?
tschafer204 0 Newbie Poster
Recommended Answers
Jump to Postuse a for loop e.g.
mylist = ['a', 'b', 'c', 'd'] for word in mylist: print word
outputs
a b c d
Jump to PostOr you could use formatted strings! Have a look at the tutorial here:http://diveintopython.org/native_data_types/formatting_strings.html
…l = [['a', 'b', 'c', 'd'],['e','f','g','h']] for item in l: print "%s %s %s %s" %(item[0], item[1],item[2],item[3])
All 5 Replies
adam1122 7 Junior Poster

leegeorg07
EvanPM 0 Newbie Poster
lllllIllIlllI 178 Veteran Poster
tschafer204 0 Newbie Poster
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.