On Tue, 30 Dec 2008 11:53:17 +0100, Glauco wrote:

>> thanks brother
>> i mean how do i particularly assign (u = this)
>>                                     (y = is)....
>> in the strings up there. i have been able to split strings with any
>> character sign.
>> 
>> 
> 
> If i'm not wrong this is simple with RE:
> 

Using Regular Expression for this is an overkill, you'd better use the 
str.split:

longstring = 'this is a python string'
splitted_string = longstring.split()
result = ', '.join(splitted_string[:-1]) + ' and ' + splitted_string[-1]

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to