ruby%w等价物 [英] ruby %w equivalent
问题描述
大家好,
是否有ruby%w运算符的python等价物?
%w {abc}创建一个包含字符串的数组" a,,b和c。在红宝石中...
非常感谢
问候,
antoine
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...
Thanks a lot
Regards,
antoine
推荐答案
Antoine De Groote写道:
Antoine De Groote wrote:
>
有一个等效于ruby%的python w运算符?
>
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()
| ['''',''b'',''c'']
....似乎与你的单个例子相符。
HTH,
John
| >>"a b c".split()
| [''a'', ''b'', ''c'']
.... appears to match your single example.
HTH,
John
ruby%w运算符是否有python等价物?
is there a python equivalent for the ruby %w operator?
%w {a b c}创建一个包含字符串a,b和c的数组。在ruby ...
%w{a b c} creates an array with strings "a", "b", and "c" in ruby...
表达式''ab c''。split()创建['''',''b'','' c''] str的列表,
如果有帮助的话。
dir(''ab c'')也简要列出了很多
http://docs.python.org/lib/string-methods .html 解释。
此外,谷歌还好奇地告诉我Ruby的'%w是
记录在哪里。
Pat LaVarre
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
p。******* @ ieee.org 写道:
>
此外,谷歌还好奇地告诉我,Ruby的'%w是
记录在哪里。
>
Also Google was curiously resistant to telling me where Ruby''s %w is
documented.
你需要挖掘你的谷歌工具栏配置和取消勾选
YAGNI过滤器。
You would need to dig into your Google toolbar config and un-tick
"YAGNI filter".
这篇关于ruby%w等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!