for param in [y["statusCode"] for x in data for y in x["positions"]]:
Change = requests.get(SetOrderStURL + param, verify=False)
Change.encoding = "utf-8"
print(Change)
for x in data:
for y in x["positions"]:
Change = requests.get(SetOrderStURL + y["statusCode"], verify=False)
Change.encoding = "utf-8"
print(Change)
>>> data = "ID: 001; Username: Ivan; Balance: 01.00; Status: active;"
>>> dict(x.split(":") for x in data.replace(" ","").split(";") if ":" in x)
{'ID': '001', 'Username': 'Ivan', 'Balance': '01.00', 'Status': 'active'}
>>> import re
>>> dict(re.findall("([^:]+):\s?([^;]+);\s?",data))
{'ID': '001', 'Username': 'Ivan', 'Balance': '01.00', 'Status': 'active'}
>>>
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
S = b'"mac" \xad\xa5 \xef\xa2\xab\xef\xa5\xe2\xe1\xef \xa2\xad\xe3\xe2\xe0\xa5\xad\xad\xa5\xa9 \xa8\xab\xa8 \xa2\xad\xa5\xe8\xad\xa5\xa9\r\n\xaa\xae\xac\xa0\xad\xa4\xae\xa9, \xa8\xe1\xaf\xae\xab\xad\xef\xa5\xac\xae\xa9 \xaf\xe0\xae\xa3\xe0\xa0\xac\xac\xae\xa9 \xa8\xab\xa8 \xaf\xa0\xaa\xa5\xe2\xad\xeb\xac \xe4\xa0\xa9\xab\xae\xac.\r\n'
S = str(S,"cp866")
import json
data = json.loads("""
{"2000000003": {"amv": true, "amvl": true, "whoa": true},
"2000000004": {"amv": true, "amvl": true, "whoa": true}}
""")
data["2000000004"]["amv"] = True
key = "2000000004"
with open("file.json","r") as inp, open("temp.json", "w") as out:
for line in inp:
linej=json.loads(line)
if key in linej:
linej[key]["amv"] = False
line = json.dumps(linej)+"\n"
out.write(line)
os.remove("file.json")
os.rename("temp.json","file.json")