4
我想学习python,但不太明白语法。什么是等价的:perl to python ...我怎么样?
my $string='this one this that this here ';
while($string=~/this\s+(.*?)\s+/g){
print $1."\n";
}
打印:
one
that
here
我想学习python,但不太明白语法。什么是等价的:perl to python ...我怎么样?
my $string='this one this that this here ';
while($string=~/this\s+(.*?)\s+/g){
print $1."\n";
}
打印:
one
that
here
尝试re
模块。我认为这相当于string
:
import re
string = "this one this that this here "
for match in re.finditer(r"this\s+(.*?)\s+", string):
print match.group(1)
这实际上很有趣。 –
@MK。请解释这些骗子。 – agf
我发现Perl和“我不懂Python语法”有趣的组合。希望我没有伤害任何人的感情。 –