客户的名字在“for”之后,在开头的括号“(”即开始投标编号)之前。我需要提取客户名称,以便在以后的步骤中查找交易。最简单的方法是什么?使用Zapier提取模式还是在Python中使用Zapier代码?你知道吗
我试过这个,但没用。不过,这似乎很有希望。你知道吗
输入\u数据
client=提醒:勒鲁斯已向您发送了一份商业名称建议书(#642931)
import regex
rgx = regex.compile(r'(?si)(?|{0}(.*?){1}|{1}(.*?)
{0})'.format('for', '('))
s1 = 'client'
for s in [s1]:
m = rgx.findall
for x in m:
print x.strip()
我也试过这个,但没用。你知道吗
start = mystring.find( 'for' )
end = mystring.find( '(' )
if start != -1 and end != -1:
result = mystring[start+1:end]
我正在寻找业务名称返回在我的例子。你知道吗
最快方式:
使用正则表达式:
可能有一种更干净的方法可以做到这一点,但这里有另一个没有regex的解决方案
另一种方法:
运行下面的代码可以得到:
代码检查最快的名字超过一百万次尝试:
相关问题 更多 >
编程相关推荐