说我有字符串testString = "x=4+y and y = 8"
我想运行findIndices(testString)
并取回包含公式项的索引列表
即这应该返回[0,1,2,3,4,10,11,12,13,14]
我想这会奏效
find equalSigns
foreach equalSign
look to the left until you see a space not preceded by an operator
put current index in formulalist
look to the right until you see a space not preceded by an operator
put current index in formulalist
put the equalSign index in the formulalist
return formulalist
1)在python中有更有效的方法吗?它是什么?(正则表达式?)
2)如果这是有效的:我如何编写“向左看”和“向右看”子例程?