Created
November 25, 2020 01:21
-
-
Save shuax/af0d7503448726931761433adb6b4608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
p = struct.Struct("<QQ") | |
i = 0 | |
out = open('weibo.bin', 'wb') | |
with open('weibo.txt', 'r', errors='ignore') as f: | |
f.readline() | |
while True: | |
line = f.readline() | |
if not line: | |
break | |
try: | |
s = line.strip().split() | |
uin, mobile = s[-1], s[0] | |
uin = int(uin) | |
mobile = int(mobile) - 13000000000 | |
# if mobile > 0xFFFFFFFF: | |
# print("big mobile",mobile) | |
# print(qq, mobile) | |
out.write(p.pack(uin, mobile)) | |
i = i + 1 | |
if i%1000000==0: | |
print(i) | |
out.flush() | |
except Exception as e: | |
print(e, line) | |
out.close() | |
print('done') |
Author
shuax
commented
Nov 28, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment