jyotsna guleria wrote:
Hello every one,

I am trying to parse a file:

I want to convert all the spaces in between the characters to single tab.

e.g: my file has contents like:

1G5 79011 1 0 2 0 0 0 0 0 0 0 5Ht-2 60459 1 1 0 0 0 0 0 0 0 0


I want them to be separated by a single tab not with spaces..

It should look like:

1G5    79011    1    0    2    0    0    0    0    0    0    0
5Ht-2    60459    1    1    0    0    0    0    0    0    0    0

each separated by Tab...

It is a text file containing such a data ..

You can try re module.
More info at:
http://docs.python.org/library/re.html
http://www.regular-expressions.info/python.html

--
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to