M
MRAB
Use the .rstrip method:If you insist on using GoogleGroups, then make sure you keep your quotes
small. I'm about to stop reading messages that are double-spaced by
buggy software.
<SNIP>
Have you tried the split (and perhaps strip) methods from
http://docs.python.org/2/library/stdtypes.html#string-methods
?
You got lots of specific advice from your previous thread. So which
version did you end up using? It'd make a good starting place for this
"problem."
can show me one line of how to implement it base on my problem?
As long as the input data is constrained not to have any embedded
commas, just use:
mylist = line.split(",")
instead of print, send your output to a list. Then for each line in the
list, fix the bracket problem to your strange specs.
outline = outline.replace("[", "(")
Hi Dave thanks for the tips,
I manage to code this:
f = open('Book1.csv', 'rU')
for row in f:
print zip([row for (row) in f])
however my output is
[('John Konon Ministry of Moon Walks 4567882 27-Feb\n',), ('Stacy Kisha Ministry of Man Power 1234567 17-Jan\n',)]
is there any method to remove the \n ?
print zip(row.rstrip('\n') for row in f)