split with "*" in string and ljust() puzzles

Sambo sambo at void.com
Thu Jun 15 00:53:52 EDT 2006


George Sakkis wrote:
> Serge Orlov wrote:
> 
> 
>>Sambo wrote:
>>
>>>I have just (finally) realized that it is splitting and removing
>>>on single space but that seams useless, and split items
>>>1 and 2 are empty strings not spaces??
>>
>>What is useless for you is worth $1,000,000 for somebody else ;)
>>If you have comma separated list '1,,2'.split(',') naturally returns
>>['1', '', '2']. I think you can get what you want with a simple regexp.
> 
> 
> No need for regexp in this case, just use None to specify one or more
> whitespace chars as delimiter: line.split(None,3)
> 
> George
> 
AHA! Thank You.



More information about the Python-list mailing list