我可以用preg_match_all('/(https?:\/\/\S+)/', $text, $links)Python 翻译PHP 吗?(即)我需要在数组中的纯文本参数中获取链接.
Wol*_*lph 14
这样做:
import re
links = re.findall('(https?://\S+)', text)
Run Code Online (Sandbox Code Playgroud)
如果你打算多次使用它,你可以考虑这样做:
import re
link_re = re.compile('(https?://\S+)')
links = link_re.findall(text)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6503 次 |
| 最近记录: |