【发布时间】:2020-11-05 23:01:57
【问题描述】:
我有一个创建未压缩公钥的脚本生成器。该脚本适用于 "bitcoin" 模块。
因此,我得到了由 130 十六进制字符组成的未压缩公钥。
我是04 [x, y]
我需要更改代码,以便只将最后一个 25 字符保存在结果中。也就是说,要剪切公钥并保存到文件中
“Pubkey.txt”
import bitcoin
with open("Privkey.txt","r") as f:
content = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
content = [x.strip() for x in content]
f.close()
outfile = open("Pubkey.txt","w")
for x in content:
outfile.write(""+bitcoin.privtopub(x)+"\n")
outfile.close()
【问题讨论】:
标签: python python-3.x list python-2.7 python-requests