Re: Slicing every element of a list

2005-07-13 Thread bruno modulix
Alex Dempsey wrote: Recently I tried to slice every element of a list of strings. First I tried: f = open(export.xls, r) http://www.python.org/doc/2.4.1/lib/module-csv.html (snip, see other posts in this thread) -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in

Slicing every element of a list

2005-07-12 Thread Alex Dempsey
Recently I tried to slice every element of a list of strings. First I tried: f = open(export.xls, r) lines = f.readlines() for line in lines: line = line[1:-5] line = line.split('\\t\') This went without returning any errors, but nothing was sliced or split. Next I tried: for i in

Re: Slicing every element of a list

2005-07-12 Thread Gary Herron
Alex Dempsey wrote: Recently I tried to slice every element of a list of strings. First I tried: f = open(export.xls, r) lines = f.readlines() for line in lines: line = line[1:-5] line = line.split('\\t\') This, in fact, did do the operation you expected, but after creating the new

Re: Slicing every element of a list

2005-07-12 Thread Scott David Daniels
Alex Dempsey wrote: Recently I tried to slice every element of a list of strings. First I tried: f = open(export.xls, r) lines = f.readlines() for line in lines: line = line[1:-5] line = line.split('\\t\') This went without returning any errors, but nothing was sliced or

Re: Slicing every element of a list

2005-07-12 Thread Thomas Lotze
Alex Dempsey wrote: for line in lines: line = line[1:-5] line = line.split('\\t\') This went without returning any errors, but nothing was sliced or split. Next I tried: for i in range(len(lines)): lines[i] = lines[i][1:-5] lines[i] = lines[i].split('\\t\') This of

Re: Slicing every element of a list

2005-07-12 Thread John Machin
Alex Dempsey wrote: Recently I tried to slice every element of a list of strings. First I tried: slice? Interesting terminology. Next problem you have, try posting an example of your input, and your expected output. E.g. repr(input_string): 'foo\tbarre\tzot\tX\n' repr(output_list): ['foo',