R
Rodrigo Daunaravicius
Is there an elegant way to directly refer the 2nd dimension of a
multi-dimensional sequence (like the nth character in a list of strings).
An example would be deleting the newline in all the strings from a list
obtained through readlines without recurring to 'for' loops.
I would expect this to work:
['0891931243\n', '0325443777\n', '0933477028\n', '0699624617\n',
'0922210996\n']
But it doesn't, d remains unchanged.
Another attempt produced what seemed to me like a counter-intuitive result
Regards from a python newbie,
Rodrigo Daunarovicius
multi-dimensional sequence (like the nth character in a list of strings).
An example would be deleting the newline in all the strings from a list
obtained through readlines without recurring to 'for' loops.
I would expect this to work:
['0891931243\n', '0325443777\n', '0933477028\n', '0699624617\n',
'0922210996\n']
['0891931243', '0325443777', '0933477028', '0699624617', '0922210996']del d[:][-1]
d
But it doesn't, d remains unchanged.
Another attempt produced what seemed to me like a counter-intuitive result
['0891931243\n', '0325443777\n', '0933477028\n', '0699624617\n']b=d[:][:-1]
b
Regards from a python newbie,
Rodrigo Daunarovicius