ruby %w equivalent

p.lavarre at ieee.org p.lavarre at ieee.org
Sun Sep 24 18:35:14 EDT 2006


> 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...

The expression 'a b c'.split() creates the ['a', 'b', 'c'] list of str,
if that helps.

Also dir('a b c') briefly lists much of what
http://docs.python.org/lib/string-methods.html explains.

Also Google was curiously resistant to telling me where Ruby's %w is
documented.

Pat LaVarre




More information about the Python-list mailing list