好吧,所以我试图从一个名为smallstr的小的其他变量中获取str(称为bigstr)中的距离,直到它结束.例如:
bigstr = 'What are you saying?'
smallstr = 'you'
then
distance = 8
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用re,但我是这个库的总菜鸟.
distance = len(bigstr) - (bigstr.index(smallstr) + len(smallstr))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
131 次 |
| 最近记录: |