我需要在之间找到任何东西
show_detail&
Run Code Online (Sandbox Code Playgroud)
和
;session_id=1445045
Run Code Online (Sandbox Code Playgroud)
在
https://www.site.gov.uk//search/cgi-bin/contract_search/contract_search.cgi?rm=show_detail&id=4035219;num=1;session_id=1445045;start=0;recs=20;subscription=1;value=0
在python中使用正则表达式.
我知道我需要使用lookbehind/ahead但我似乎无法使它工作!
请帮忙!
谢谢 :)
为什么要使用正则表达式?
>>>> url = 'https://ww.site.gov.....'
>>> start = url.index('show_detail&') + len('show_detail&')
>>> end = url.index(';session_id=')
>>> url[start:end]
'id=4035219;num=1'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
673 次 |
| 最近记录: |