WSH.SendKeys("{f2}");
os.system("cscript c:\myscript.js")
#посмотреть угаданную автоматом кодировку
print(r.encoding)
# установить реальную кодировку (какая там - я не знаю, cp1251 написал просто так)
r.encoding = 'cp1251'
text = r.text
data = json.loads(text)
write_json(data)
with open('posts.json', 'w', encoding='utf-8') as file:
x1 = data['result']['stats'][i]['hi']
_x = data['result']
_x = _x['stats']
_x = _x[i]
x1 = _x['hi']
<Имя> <Тел>
<Имя>
на Петров Пётр Петрович
. total = 10
print("RANDOM:")
import random
for n in range(total):
rest = random.randint(0,10**10-1)
code = "{n:06}{rest:010}".format(n=n, rest=rest)
formatted = code[0:4] + "-" + code[4:8] + "-" + code[8:12] + "-" + code[12:]
print(formatted)
print("TESTABLE:")
import hashlib
SALT = "some_salt"
def generate(n):
_bytes = (str(n) + SALT).encode("ascii")
_hash = hashlib.md5(_bytes).hexdigest()
rest = int(_hash, base=16) % (10**10)
code = "{n:06}{rest:010}".format(n=n, rest=rest)
formatted = code[0:4] + "-" + code[4:8] + "-" + code[8:12] + "-" + code[12:]
return formatted
def test(code):
raw_code = code.replace("-","")
n = int(raw_code[0:6])
return code == generate(n)
for n in range(total):
code = generate(n)
print(code, test(code))