-
-
未解决 [求助]python3无法解析种子链接
-
2021-2-6 17:16 2681
-
#!/usr/bin/python
import sys, os, hashlib
import bencode
def main():
1 2 3 4 5 | # Open torrent file torrent_file = open (sys.argv[ 1 ], "rb" ) metainfo = bencode.bdecode(torrent_file.read()) info = metainfo[ 'info' ] print (hashlib.sha1(bencode.bencode(info)).hexdigest()) |
if name == "main":
main()
同样的代码,python2可以通过,python3报错。
报错的信息如下:
Traceback (most recent call last):
File "testtr.txt", line 14, in <module>
main()
File "testtr.txt", line 9, in main
metainfo = bencode.bdecode(torrent_file.read())
File "d:\python37\Lib\site-packages\bencode.py", line 68, in bdecode
BTL.BTFailure: not a valid bencoded string
如何解决?
[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法
赞赏
他的文章
赞赏
雪币:
留言: