How to manipulate a contents of file as record structures

2009-01-31 Thread CK Raju
I have a text file containing the following alphanumerals.
aa2255
hh11dpdpdpdp22
kkk21lokolkolko33
.

I need to read the contents as single line, one after the other
and append the sum of digits at the end.
aa225577
hh11dpdpdpdp2233
kkk21lokolkolko3354


What would be a simple way to achieve this ?
CK Raju
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to manipulate a contents of file as record structures

2009-01-31 Thread CK Raju
On Sat, Jan 31, 2009 at 4:19 PM, Gabriel Genellina
 wrote:
> for line in f:
>  do_something_with(line)

Thanks a lot.
CK Raju
--
http://mail.python.org/mailman/listinfo/python-list