Commit a2a32d16 authored by moden's avatar moden

JSON parser task

parents
**Python education**
\ No newline at end of file
"""
Write a parser for simple.json file.
Print a person name his(her) friend names in format:
====================
Mildred Eaton
Marquez Hall
Potts Giles
Noelle Mcneil
====================
Edna Duffy
Mcgee Stanton
...
"""
def parser(filename):
# Your code here
pass
def main():
# parse command line with filename
filename = ''
parser(filename)
if __name__ == '__main__':
main()
[
{
"_id": "5af1553c5dd5bd7bd97602d8",
"index": 0,
"guid": "10dd5bf3-8e28-4352-bd5a-af9d2ea99302",
"isActive": false,
"balance": "$1,910.20",
"picture": "http://placehold.it/32x32",
"age": 40,
"eyeColor": "blue",
"name": "Mildred Eaton",
"gender": "female",
"company": "ISOTRONIC",
"email": "mildredeaton@isotronic.com",
"phone": "+1 (831) 486-3242",
"address": "302 Covert Street, Marion, North Dakota, 9569",
"about": "Ea velit qui eu occaecat nulla sint consequat dolor est eu et ea nisi. Ex et fugiat ullamco voluptate dolore. Eu irure irure mollit sint pariatur et ad sit nisi pariatur. Duis Lorem adipisicing voluptate reprehenderit pariatur ut ut ullamco sunt fugiat qui sunt eiusmod.\r\n",
"registered": "2015-08-02T11:31:19 -03:00",
"latitude": -38.261304,
"longitude": 76.529519,
"tags": [
"fugiat",
"qui",
"deserunt",
"anim",
"pariatur",
"dolor",
"commodo"
],
"friends": [
{
"id": 0,
"name": "Marquez Hall"
},
{
"id": 1,
"name": "Potts Giles"
},
{
"id": 2,
"name": "Noelle Mcneil"
}
],
"greeting": "Hello, Mildred Eaton! You have 5 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5af1553c3fdf5c88812bb862",
"index": 1,
"guid": "06b9ae20-8e1a-433b-b382-cf1b00b90024",
"isActive": false,
"balance": "$1,731.71",
"picture": "http://placehold.it/32x32",
"age": 30,
"eyeColor": "brown",
"name": "Edna Duffy",
"gender": "female",
"company": "NEPTIDE",
"email": "ednaduffy@neptide.com",
"phone": "+1 (987) 487-3589",
"address": "247 Underhill Avenue, Woodburn, Wisconsin, 233",
"about": "Ut exercitation aliqua veniam voluptate aliqua dolor nostrud ullamco deserunt tempor sit ad Lorem veniam. Sint et eu voluptate exercitation ad ipsum ut adipisicing velit duis. Cupidatat officia duis sunt officia sunt cillum aute. Voluptate sit amet fugiat ullamco.\r\n",
"registered": "2017-08-26T10:49:10 -03:00",
"latitude": 44.34086,
"longitude": -10.144497,
"tags": [
"adipisicing",
"in",
"in",
"dolore",
"cillum",
"reprehenderit",
"quis"
],
"friends": [
{
"id": 0,
"name": "Mcgee Stanton"
},
{
"id": 1,
"name": "Washington Leon"
},
{
"id": 2,
"name": "Mavis Mccullough"
}
],
"greeting": "Hello, Edna Duffy! You have 5 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "5af1553cb1496a91abf6a18e",
"index": 2,
"guid": "cbbd0d60-4002-46bf-8d43-0064e41e63f9",
"isActive": true,
"balance": "$2,429.29",
"picture": "http://placehold.it/32x32",
"age": 21,
"eyeColor": "blue",
"name": "Callahan Mcgee",
"gender": "male",
"company": "EXTRAGEN",
"email": "callahanmcgee@extragen.com",
"phone": "+1 (806) 472-2428",
"address": "808 Blake Court, Zeba, Tennessee, 9363",
"about": "Qui nostrud tempor exercitation consequat duis adipisicing reprehenderit. Ullamco aliquip voluptate dolor adipisicing cupidatat aute consectetur Lorem. Non sint amet culpa quis laborum fugiat quis anim qui irure et consequat.\r\n",
"registered": "2015-04-05T04:25:50 -03:00",
"latitude": -24.163639,
"longitude": -42.434423,
"tags": [
"mollit",
"incididunt",
"ut",
"sunt",
"consequat",
"mollit",
"pariatur"
],
"friends": [
{
"id": 0,
"name": "Silva Bright"
},
{
"id": 1,
"name": "Annette Best"
},
{
"id": 2,
"name": "Rene Burks"
}
],
"greeting": "Hello, Callahan Mcgee! You have 9 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5af1553c8ad822090ad5acd0",
"index": 3,
"guid": "9ad42659-ee72-4321-95c6-fa23259ddf13",
"isActive": false,
"balance": "$2,850.07",
"picture": "http://placehold.it/32x32",
"age": 40,
"eyeColor": "brown",
"name": "Allison Skinner",
"gender": "male",
"company": "EXOSIS",
"email": "allisonskinner@exosis.com",
"phone": "+1 (865) 488-3326",
"address": "224 Noll Street, Brule, Virgin Islands, 4144",
"about": "Est amet aliquip culpa exercitation labore ad adipisicing fugiat duis velit velit. Laborum est sit consequat anim aliquip est. Lorem voluptate nostrud culpa aute amet. Veniam commodo incididunt non id reprehenderit tempor reprehenderit occaecat mollit. Quis incididunt dolore quis ea.\r\n",
"registered": "2014-09-07T03:01:24 -03:00",
"latitude": 70.302333,
"longitude": 131.03409,
"tags": [
"officia",
"dolore",
"dolore",
"do",
"laboris",
"aliqua",
"cupidatat"
],
"friends": [
{
"id": 0,
"name": "Gale Gallegos"
},
{
"id": 1,
"name": "Stokes Atkinson"
},
{
"id": 2,
"name": "Lorrie Snider"
}
],
"greeting": "Hello, Allison Skinner! You have 6 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5af1553c18cf664f2bdfd6a8",
"index": 4,
"guid": "ec111b3d-7d5c-48d5-9c66-92fa0f7a79b3",
"isActive": true,
"balance": "$2,428.27",
"picture": "http://placehold.it/32x32",
"age": 21,
"eyeColor": "brown",
"name": "Zelma Stout",
"gender": "female",
"company": "ENTHAZE",
"email": "zelmastout@enthaze.com",
"phone": "+1 (913) 526-3448",
"address": "211 Voorhies Avenue, Williamson, Federated States Of Micronesia, 9334",
"about": "Eu enim velit Lorem ad sint Lorem minim incididunt esse amet consectetur amet. Deserunt occaecat velit consequat exercitation et eiusmod duis ex dolor incididunt officia ad nisi. Id ea exercitation sunt esse et ad proident esse veniam et dolor deserunt ea aliqua. Voluptate ea et sit consectetur mollit.\r\n",
"registered": "2017-09-01T01:04:44 -03:00",
"latitude": -53.827728,
"longitude": 104.825181,
"tags": [
"veniam",
"excepteur",
"laborum",
"aute",
"fugiat",
"est",
"fugiat"
],
"friends": [
{
"id": 0,
"name": "Lina Brown"
},
{
"id": 1,
"name": "Whitney Peters"
},
{
"id": 2,
"name": "Pearl Paul"
}
],
"greeting": "Hello, Zelma Stout! You have 9 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "5af1553ca09d58ca518caf53",
"index": 5,
"guid": "f2485a6f-5e27-4576-9d20-b1ac9d0ce4cf",
"isActive": false,
"balance": "$1,316.43",
"picture": "http://placehold.it/32x32",
"age": 34,
"eyeColor": "blue",
"name": "Lesley Mccray",
"gender": "female",
"company": "BARKARAMA",
"email": "lesleymccray@barkarama.com",
"phone": "+1 (941) 577-3924",
"address": "327 Sandford Street, Ticonderoga, New Jersey, 6184",
"about": "Aute in magna fugiat est cillum labore anim nisi proident proident. Labore eiusmod fugiat culpa ipsum dolor in Lorem sit ad do ipsum in laboris velit. Consequat ullamco nisi enim pariatur quis ex ipsum commodo ad labore nisi ullamco enim ea. Voluptate laboris officia nisi et. Officia veniam ipsum eiusmod officia laboris mollit.\r\n",
"registered": "2016-02-24T06:55:35 -02:00",
"latitude": 22.258037,
"longitude": -178.20573,
"tags": [
"nisi",
"nulla",
"dolore",
"et",
"dolore",
"esse",
"sint"
],
"friends": [
{
"id": 0,
"name": "Roberson Campos"
},
{
"id": 1,
"name": "Floyd Shannon"
},
{
"id": 2,
"name": "Dorsey Leonard"
}
],
"greeting": "Hello, Lesley Mccray! You have 8 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "5af1553c590fd02924fd7a40",
"index": 6,
"guid": "ef61938c-20f6-4e82-861d-24ae0e30d53a",
"isActive": true,
"balance": "$2,693.08",
"picture": "http://placehold.it/32x32",
"age": 31,
"eyeColor": "green",
"name": "Whitehead French",
"gender": "male",
"company": "ENDIPINE",
"email": "whiteheadfrench@endipine.com",
"phone": "+1 (819) 493-2192",
"address": "995 Harkness Avenue, Moscow, Ohio, 726",
"about": "In nisi eu irure adipisicing elit dolore aliquip. Commodo cillum cillum ut velit culpa fugiat aliquip culpa et nostrud id sint. Reprehenderit ea proident et ullamco aute ad ullamco duis duis. Reprehenderit nisi mollit elit laboris qui incididunt cillum do eu. Excepteur ipsum eiusmod sint aute nulla labore amet. Magna excepteur commodo duis velit est.\r\n",
"registered": "2014-06-21T09:27:33 -03:00",
"latitude": -82.854104,
"longitude": -141.716088,
"tags": [
"commodo",
"velit",
"reprehenderit",
"culpa",
"mollit",
"ea",
"non"
],
"friends": [
{
"id": 0,
"name": "Laurel Schwartz"
},
{
"id": 1,
"name": "Graves Vinson"
},
{
"id": 2,
"name": "Snider Suarez"
}
],
"greeting": "Hello, Whitehead French! You have 4 unread messages.",
"favoriteFruit": "apple"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment