File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "name" : " test" ,
3+ "ip" : " 198.168.23.45" ,
4+ "country" : " United States" ,
5+ "project" : " Data Analytics" ,
6+ "website" : " scriptscrunch.com"
7+ }
Original file line number Diff line number Diff line change 1+ import json
2+ import os
3+
4+ # Script to create absolute path of the JSON file.
5+
6+ script_dir = os .path .dirname (__file__ )
7+ print ("The Script is located at:" + script_dir )
8+ script_absolute_path = os .path .join (script_dir , 'example.json' )
9+ print ("The Script Path is:" + script_absolute_path )
10+
11+ # Script to parse JSON
12+
13+ json = json .loads (open (script_absolute_path ).read ())
14+ value = json ['name' ]
15+ print (value )
16+
17+ # Loop through JSON
18+
19+ for key in json :
20+ value = json [key ]
21+ print ("The key and value are ({}) = ({})" .format (key , value ))
Original file line number Diff line number Diff line change 1+ import os
2+
3+ # 1. Create Directory
4+ # 2. Delete Directory
5+ # 3. List Directory
6+ # 4. List total number of folder in a Directory
7+ # 5. List total numbers of files in a Directory
You can’t perform that action at this time.
0 commit comments