How to manipulate a contents of file as record structures

CK Raju ck.thrissur at gmail.com
Sat Jan 31 05:35:44 EST 2009


I have a text file containing the following alphanumerals.
aaaaaa22bbbbbbbb55
hhhhhh11dpdpdpdp22
kkkkkkk21lokolkolko33
.....

I need to read the contents as single line, one after the other
and append the sum of digits at the end.
aaaaaa22bbbbbbbb5577
hhhhhh11dpdpdpdp2233
kkkkkkk21lokolkolko3354
....

What would be a simple way to achieve this ?
CK Raju



More information about the Python-list mailing list