所以我一直在尝试使用regex(仍在学习),并试图得到这个组合的最后一个值
new avCombination('919712-041','HelloWorld','40.5');
new avCombination('919712-041','HelloWorld','41');
new avCombination('919712-041','HelloWorld','42');
new avCombination('919712-041','HelloWorld','42.5');
new avCombination('919712-041','HelloWorld','43');
new avCombination('919712-041','HelloWorld','44');
new avCombination('919712-041','HelloWorld','44.5');
new avCombination('919712-041','HelloWorld','45');
new avCombination('919712-041','HelloWorld','45.5');
我一直在尝试如何使用python,但我在这方面遇到了困难
*Updated:*
for values in re.findall('(\d+)(?=\'\);)', listOfCombinations)):
print(values)
但我得到的错误是每个的最后一个数字。所以意思是ETC40.5会返回我5而不是40.5
我相信我的正则表达式做错了!我该怎么解决呢
你得到的错误是由于你试图打开包装。请注意,
re.findall()
返回一个列表,因此您需要执行以下操作:假设您试图解析的JS函数中的最后一个参数始终是
float
,您可以执行以下操作(其中s
是包含所有JS函数的字符串):收益率:
相关问题 更多 >
编程相关推荐