split function

Peter Hansen peter at engcorp.com
Mon Aug 22 18:28:12 CEST 2005


Mohammed Altaj wrote:
>      I am reading data from file using readlines() to list , my question
> is how to deal with space between any two numbers , I mean , my data

What do you mean by "deal with"?  Please describe the input and the 
desired output, or what operations you are trying to perform, or 
something.  "Deal with" could mean anything, so it means nothing.

> looks like
> 1 3
> 3 4
> 5 2
> 6 1
> 
> I tried to with my data as it, but i couldn't , so i removed the spaces
> 13
> 34
> 52
> 61
> 
> But when i deal with large number > 9 !!!! , i tried to use split
> function , but doesn't work , I can attach my code if its good idea to do ,,

It would probably be a good idea to attach some code, if it's not too 
long (no longer than 100 lines or so, preferably less).  I'm afraid that 
I'm having trouble understanding what you want, and I suspect many other 
people are too.  I also recommend showing an example, with input and 
output, of what you want to achieve: the "before and after" picture.  An 
example goes a long way towards communicating one's goal.

-Peter



More information about the Python-list mailing list