I have the following multi-dictionaries which are inputs to the python script:
{ 123 {'all_uppercase': 0, '#': 1, 'longword': 5, '@': 1} }
{ 486 {'all_uppercase': 0, '#': 0, 'longword': 0, '@': 0} }
I have to convert into numbering format i.e. 123 will be 1, 486 will be 2 and so on.
For 'all_uppercase': 0, '#': 1, 'stop_words': 10,'longword': 5, '@': 1
all_uppercase will be 1, stop_words will be 2, longword will be 3, @ will be 4.
So the final output that should be printed should look like this:
{ 1 {'1': 0, '2': 1, '3': 5, '4': 1} }
{ 2 {'1': 0, '2': 0, '3': 0, '4': 0} }
Here is my code:
inner_dict = {}
count =0
def analyze_tweets():
for line in sys.stdin:
d = ast.literal_eval(line)
for k,v in d.items():
inner_dict = dicts.setdefault(k, {})
for i in inner_dict.items()