ruby %w equivalent
Georg Brandl
g.brandl-nospam at gmx.net
Mon Sep 25 16:36:49 EDT 2006
Thorsten Kampe wrote:
> * John Machin (24 Sep 2006 15:32:20 -0700)
>>Antoine De Groote wrote:
>>> is there a python equivalent for the ruby %w operator?
>>> %w{a b c} creates an array with strings "a", "b", and "c" in ruby...
>>>
>>
>>| >>> "a b c".split()
>>| ['a', 'b', 'c']
>>
>>... appears to match your single example.
>
> Something wrong with "list('abc')"? Or is it too simple?!
It is quite unreliable for strings consisting of more than one char... ;)
Georg
More information about the Python-list
mailing list