[英]Find word with Python "Regex"
can you help please: i want to get the adress from that text using python:你能帮忙吗:我想使用 python 从该文本中获取地址:
[RIPH] harambe protocol
First alert listed in this telegram group 637 seconds before anyone else.
Coin name: harambe protocol
Address: 0x10964C2ffDEA1e99B5e26D102516d9b03368915f
Platform: BSC
Time: 08:02:58 UTC
try this:尝试这个:
import re
pattern = "Address:.*(0x.*)"
address = re.findall(pattern, your_text, re.MULTILINE)
print(address)
Would you please try the following:请您尝试以下方法:
#!/usr/bin/python
import re
with open('textfile') as f:
for line in f:
m = re.search(r'Address:\s*(0[xX][0-9A-Fa-f]+)', line)
if (m):
print(m.group(1))
Output: Output:
0x10964C2ffDEA1e99B5e26D102516d9b03368915f
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.