Python pull variable values from the dictionary

{"status":"success","result":[
{"picture":"data:image\/png;base64,","name":"\u0420\u0430\u0437\u0431\u0430\u043d","username":"Akkermanov"},
{"picture":"data:image\/png;base64,","name":"250 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 40 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Ferrari_benz"},
{"picture":"data:image\/png;base64,","name":"100 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 15 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Feather_YT"},
{"picture":"data:image\/png;base64,","name":"20 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 0 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"pipo_pirat498"},
{"picture":"data:image\/png;base64,","name":"20 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 0 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Hallker_YT"},
{"picture":"data:image\/png;base64,","name":"100 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 15 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Johny_LayYT"}]}

You need to pull out the name and username values And preferably in the format

Name1: \u0420\u0430\u0437\u0431\u0430\u043d username1: Akkermanov

Name2: 250 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 40 \u0440\u0443\u0431\u043b\u0435\u0439] username2: Ferrari_benz

Name3: 100 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 15 \u0440\u0443\u0431\u043b\u0435\u0439] username3: Feather_YT

Name4: 20 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 0 \u0440\u0443\u0431\u043b\u0435\u0439] username4: pipo_pirat498

Name5: ... username5: ... name6: ... username6: ...

I'm quite a beginner, so please keep it as simple as possible to understand

Here is the full code

from requests import request
import time
n = 1
while True:
    t = request('GET', 'https://sunmc.ru/last-purchases').text
    with open('test.html', 'w') as f:
        f.write(t)
        n=n+1
        temp = t["result"]
        index = 1
        for i in temp:
            print("name{}:".format(index), i["name"], end=" ")
            print("username{}:".format(index), i["username"])
            index += 1
            time.sleep(1000)
Author: Kotenok, 2020-09-25

1 answers

a = {"status":"success","result":[
{"picture":"data:image\/png;base64,","name":u"\u0420\u0430\u0437\u0431\u0430\u043d","username":"Akkermanov"},
{"picture":"data:image\/png;base64,","name":"250 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 40 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Ferrari_benz"},
{"picture":"data:image\/png;base64,","name":"100 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 15 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Feather_YT"},
{"picture":"data:image\/png;base64,","name":"20 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 0 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"pipo_pirat498"},
{"picture":"data:image\/png;base64,","name":"20 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 0 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Hallker_YT"},
{"picture":"data:image\/png;base64,","name":"100 \u0420\u0443\u0431\u043b\u0435\u0439 [\u0411\u043e\u043d\u0443\u0441 - 15 \u0440\u0443\u0431\u043b\u0435\u0439]","username":"Johny_LayYT"}]}

temp =  a["result"]
index = 1
for i in temp:
    print("name{}:".format(index), i["name"], end=" ")
    print("username{}:".format(index), i["username"])
    index += 1

Conclusion:

name1: Разбан username1: Akkermanov
name2: 250 Рублей [Бонус - 40 рублей] username2: Ferrari_benz
name3: 100 Рублей [Бонус - 15 рублей] username3: Feather_YT
name4: 20 Рублей [Бонус - 0 рублей] username4: pipo_pirat498
name5: 20 Рублей [Бонус - 0 рублей] username5: Hallker_YT
name6: 100 Рублей [Бонус - 15 рублей] username6: Johny_LayYT

Or so, without decoding unicode characters:

temp =  a["result"]
index = 1
for i in temp:
    i["name"].replace("\\","\\")
    print("name{}:".format(index), i["name"].encode('raw_unicode_escape'), end=" ")
    print("username{}:".format(index), i["username"])
    index += 1

The output will be as follows:

name1: b'\\u0420\\u0430\\u0437\\u0431\\u0430\\u043d' username1: Akkermanov
name2: b'250 \\u0420\\u0443\\u0431\\u043b\\u0435\\u0439 [\\u0411\\u043e\\u043d\\u0443\\u0441 - 40 \\u0440\\u0443\\u0431\\u043b\\u0435\\u0439]' username2: Ferrari_benz
name3: b'100 \\u0420\\u0443\\u0431\\u043b\\u0435\\u0439 [\\u0411\\u043e\\u043d\\u0443\\u0441 - 15 \\u0440\\u0443\\u0431\\u043b\\u0435\\u0439]' username3: Feather_YT
name4: b'20 \\u0420\\u0443\\u0431\\u043b\\u0435\\u0439 [\\u0411\\u043e\\u043d\\u0443\\u0441 - 0 \\u0440\\u0443\\u0431\\u043b\\u0435\\u0439]' username4: pipo_pirat498
name5: b'20 \\u0420\\u0443\\u0431\\u043b\\u0435\\u0439 [\\u0411\\u043e\\u043d\\u0443\\u0441 - 0 \\u0440\\u0443\\u0431\\u043b\\u0435\\u0439]' username5: Hallker_YT
name6: b'100 \\u0420\\u0443\\u0431\\u043b\\u0435\\u0439 [\\u0411\\u043e\\u043d\\u0443\\u0441 - 15 \\u0440\\u0443\\u0431\\u043b\\u0435\\u0439]' username6: Johny_LayYT
 2
Author: RomanR, 2020-09-25 14:02:03