ruby %w equivalent

Robert Kern robert.kern at gmail.com
Mon Sep 25 00:34:41 CEST 2006


Antoine De Groote wrote:
> Hi everybody,
> 
> 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...

I assume that

   ['a', 'b', 'c']

isn't what you are looking for. How does

   'a b c'.split()

strike you?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list