December 3rd, 2001, 09:52 AM
adding "\n" to python list items
I know what I have to do, I want to split a results list from a database query into single lines for formatting reasons. I am however unsure of the syntax of how to do this, if anyone could help it would be very helpful
December 4th, 2001, 03:18 AM
I'm not sure what you want, but I guess you want to add a newline between every result. Then just use string.join like this:
You should import the string module first to use this.
joined_string = string.join(list, 'n')
Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. - Jamie Zawinski, in comp.lang.emacs