Created
August 11, 2020 07:37
-
-
Save manishmore/20f72384234bcae5a1413828a3200f7c to your computer and use it in GitHub Desktop.
Search based on the user input from json file given.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import datetime | |
import re | |
# Input the key value that you want to search | |
keyVal = input("Enter a key value: \n") | |
keyNum = input("Enter a number of days: \n") | |
with open('metadata.json') as json_file: | |
data = json.load(json_file) | |
for p, item in enumerate(data): | |
for Itemcount,iterator_var in enumerate(item): | |
if item[iterator_var] == keyVal: | |
print(item) | |
for value,valueItem in enumerate(item): | |
l = re.compile("T").split(item['creationTimestamp']) | |
valueDay = re.compile("-").split(l[0]) | |
diffVal = valueDay[2] | |
#print(diffVal) | |
#print(valueItem) | |
pass | |
#print('test') | |
#print(item) | |
#print(p) | |
#print(iterator_var) | |
#print('Name: ' + p) | |
#print('Website: ' + p['website']) | |
#print('From: ' + p['from']) | |
#print('') | |
#print(keyNum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment