常用表达。 [英] regular expressions.
问题描述
嘿所有,
我一直在玩RE并且无法获得以下
代码来运行。
>
import re
元音= r''[aeiou]''
re.findall(元音,r元音)
我做错了什么?
问候,
Atul。
Hey All,
I have been playing around with REs and could not get the following
code to run.
import re
vowel = r''[aeiou]''
re.findall(vowel, r"vowel")
anything wrong I have done?
Regards,
Atul.
推荐答案
Atul。写道:
Atul. wrote:
我一直在玩RE,无法获得以下
代码来运行。
>
import re
元音= r''[aeiou]''
re.findall(元音,r元音)
我做错了什么?
I have been playing around with REs and could not get the following
code to run.
import re
vowel = r''[aeiou]''
re.findall(vowel, r"vowel")
anything wrong I have done?
是的。你没有将回溯粘贴到你的消息中。
Yes. You didn''t paste the traceback into your message.
>> import re
vowel = r''[aeiou]''
re.findall(vowel,r" vowel")
>>import re
vowel = r''[aeiou]''
re.findall(vowel, r"vowel")
[''o'',''e'']
这里按预期工作。
彼得>
是的。你没有将回溯粘贴到你的消息中。
Yes. You didn''t paste the traceback into your message.
> import re
vowel = r''[ aeiou]''
re.findall(元音,r"元音")
>import re
vowel = r''[aeiou]''
re.findall(vowel, r"vowel")
[''o'',''e' ']
这里按预期工作。
Peter
[''o'', ''e'']
It works as expected here.
Peter
我在IDLE中键入此输入它可以工作但是当我尝试运行
模块时它不会工作。
When I key this input in IDLE it works but when I try to run the
module it wont work.
Atul。写道:
Atul. wrote:
>
>
>是的。你没有将回溯粘贴到你的消息中。
>Yes. You didn''t paste the traceback into your message.
>> import re
vowel = r''[aeiou]''
re.findall(vowel,r" vowel")
>>import re
vowel = r''[aeiou]''
re.findall(vowel, r"vowel")
['''',''e'']
按预期工作在这里。
Peter
[''o'', ''e'']
It works as expected here.
Peter
当我在IDLE中键入此输入时,它可以工作,但是当我尝试运行
$ b $时b模块它不会工作。
When I key this input in IDLE it works but when I try to run the
module it wont work.
你的脚本名称是什么?你跑的时候会发生什么?是否会打印回溯?
回溯?如果是这样,它说什么?请剪切并粘贴,不要
释义。
Peter
What''s the name of your script? What happens when you run it? Does it print
a traceback? If so, what does it say? Please cut and paste, don''t
paraphrase.
Peter
这篇关于常用表达。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!