easy but difficult

Matthieu Brucher matthieu.brucher at gmail.com
Tue Oct 16 12:40:46 CEST 2007


Hi,

Use write() instead of print

Matthieu

2007/10/16, Beema shafreen <beema.shafreen at gmail.com>:
>
> hi everybody,
>   I have  a file  separated by hash:
> as shown below,
> file:
> A#1
> B#2
> A#2
> A#3
> B#3
>
> I need the result like this:
> A 1#2#3
> B 2#3
>
> how will generate the result like this from the above file
> can somebody tell me what i have to do......
> My code:
>           fh =open('abc_file','r')
>           for line in fh.readlines():
>                    data = line.strip().split('#')
>                     for data[0] in line
>                             print line
>
> I tried but i donot know how to create 1#2#3 in a single line
> regards
> shafreen
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071016/03185f77/attachment.html>


More information about the Python-list mailing list