Strings for a newbie
bruno modulix
onurb at xiludom.gro
Fri May 27 10:36:45 EDT 2005
Malcolm Wooden wrote:
(top post corrected)
>
> "John Machin" <sjmachin at lexicon.net> wrote in message
> news:42970d69 at news.eftel.com...
>
>>Malcolm Wooden wrote:
>>
(snip useless rant)
>>>
>>>I want to put a sentence of words into an array, eg "This is a sentence
>>>of words"
>>>
>>>In RB it would be simple:
>>>
(snip 'simple' example)
>>>
(snip other useless rant)
>>
>>>>>s = "This is a sentence of words"
>>>>>a = s.split()
>>>>>a
>>
>>['This', 'is', 'a', 'sentence', 'of', 'words']
>>
> Sorry John but that don't do it for me. Just get errors comming back
http://www.catb.org/~esr/faqs/smart-questions.html
Strange enough, I used variations of the above code - which is a pretty
common Python idiom - in tens and tens of working applications...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list