Home>
I want to extract a double dictionary from a for sentence.
No = 0
VV = {}
WW = {}
KF = {}
NE = {}
JE = {}
for YY, NN in zip (total1, LL):
#print (YY, NN)
TT = NN.values ()
JD = NN.keys ()
No + = 1
for RR, MA in zip (TT, JD):
TF = RR/YY
VV [MA] = TF
WW.update (VV)
JE [No] = WW
UW = JE
print (UW)
KF.update (UW)
JE.clear ()
WW.clear ()
VV.clear ()
print (KF)
When UW is output, it looks like the following
Actually, 1 to 710 article data is output, but since it is long, only 710th is described.
{710: {'KOEI TECMO GAMES': 0.004405286343612335, ':' 0.022026431718061675, ',': 0.030837004405286344, '9': 0.004405286343612335, 'Month': 0.006607929515418502, '27': 0.0022026431718061676, 'Day ': 0.004405286343612335,' (': 0.004405286343612335,' Steam ': 0.0022026431718061676,' version ': 0.0022026431718061676,' 10 ': 0.0022026431718061676,' 16 ': 0.0022026431718061676,') ': 0.004405286343612335,' to ': 0.03303964757709251,' released: 0.03303964757709251, ' 0.0022026431718061676, 'to': 0.030837004405286344, 'planned': 0.004405286343612335, 'to': 0.028634361233480177, 'te': 0.004405286343612335, 'is': 0.004405286343612335, 'playstation': 0.0022026431718061676, '': 0.048458149779735685, '4180', 0.004/': 0.0022026431718061676,' Nintendo ': 0.0022026431718061676,' Switch ': 0.0022026431718061676,' For ': 0.0022026431718061676,' Tactical Action ': 0.0022026431718061676,' ': 0.022026431718061675,' Musou ': 0.006607929515418502,' O 'ROCHI': 0.006607929515418502, '3': 0.006607929515418502, '"': 0.022026431718061675, '': 0.04405286343612335, 'Latest': 0.0022026431718061676, 'Information': 0.0022026431718061676, 'Public': 0.00881057268722467, 'A': 0.03303964757709251, ' ': 0.05066079295154185,' This time ': 0.004405286343612335,' New ': 0.0022026431718061676,' Character ': 0.006607929515418502,' Perseus ': 0.0022026431718061676,' Introduction ': 0.0022026431718061676,' Video ': 0.0022026431718061676,' Be ': 0.03303964757709251,' 0.011013215859030838, 'CV': 0.004405286343612335, 'Shimo': 0.0022026431718061676, '紘': 0.0022026431718061676, 'Mr': 0.0022026431718061676, 'Working': 0.0022026431718061676, 'Other': 0.0022026431718061676, 'Even': 0.00220264317180616440, 'Story': 0.00220264317180616440, '634' 'Key': 0.006607929515418502, 'And': 0.013215859030837005, 'Become': 0.013215859030837005, 'Special': 0.0022026431718061676, 'O': 0.013215859030837005, 'Figure': 0.004405286343612335, 'To': 0.006607929515418502, 'Change': 0.004405286343612335, 'God' ': 0.006607929515418502,' Conversion ': 0.006607929515418502,' About ': 0.0022026431718061676,' Seki ': 0.004405286343612335,' Silver ': 0.004405286343612335,', ': 0.004405286343612335,' Target ': 0.0022026431718061676, 'That': 0.0022026431718061676, 'Clear': 0.0022026431718061676, 'More': 0.0022026431718061676, 'God': 0.00881057268722467, 'Power': 0.006607929515418502, 'Get': 0.004405286343612335, 'Item': 0.0022026431718061676, '264' '2': 0.0022026431718061676, 'Species': 0.0022026431718061676, 'Olympus': 0.0022026431718061676, 'Heroes': 0.004405286343612335, 'Yes': 0.00881057268722467, 'Zeus': 0.004405286343612335, 'People': 0.004405286343612335, 'Danaer 180': 220 '264' ': 0.0022026431718061676,' Birth ': 0.0022026431718061676,' Half ': 0.0022026431718061676,' Medusa ': 0.0022026431718061676,' Killing ': 0.0022026431718061676,' Achievement ': 0.0022026431718061676,' As': 0.0022026431718061676, 'Worried' 616: 220 0.0022026431718061676, 'Like': 0.0022026431718061676, 'By': 0.0022026431718061676, 'Human': 0.0022026431718061676, 'Boundary': 0.002202 6431718061676, 'Intervention': 0.0022026431718061676, 'Depressed': 0.0022026431718061676, 'World': 0.0022026431718061676, 'Confusion': 0.0022026431718061676, 'Prevent': 0.0022026431718061676, 'For': 0.0022026431718061676, 'Stand up': 0.0022026431718061676, '317', 264 'Name': 0.0022026431718061676, 'Body': 0.004405286343612335, 'Accommodates': 0.0022026431718061676, 'Done': 0.0022026431718061676, 'New': 0.0022026431718061676, ':': 0.0022026431718061676, 'Three': 0.0022026431718061676, 'Upper branch': 0.00220264317180 ': 0.0022026431718061676,' decision ': 0.004405286343612335,' very hard ': 0.0022026431718061676,' disease ': 0.0022026431718061676,' good ': 0.0022026431718061676,' defense ': 0.0022026431718061676,' judgment ': 0.0022026431718061676,' go ': 0.0022026431718061676,' 0.0022026431718061676, 'learn': 0.0022026431718061676, 'martial arts': 0.0022026431718061676, 'talents': 0.0022026431718061676, 'demonstration': 0.0022026431718061676, 'incredible': 0.00220264317180 61676, 'Striking power': 0.0022026431718061676, 'Principal': 0.0022026431718061676, 'Notice': 0.0022026431718061676, 'Not': 0.0022026431718061676, 'Guardian deity': 0.0022026431718061676, 'Hell': 0.0022026431718061676, 'Female': 0.0022026431718061676, '634' 'Wings': 0.0022026431718061676,' Grows': 0.0022026431718061676, 'Magic': 0.0022026431718061676, 'Shoes': 0.0022026431718061676,' Turns': 0.0022026431718061676, 'People': 0.0022026431718061676, 'Wind': 0.0022026431718061676, 'Overtake': 0.00 '22026431718076 ': 0.0022026431718061676,' Sennin ': 0.0022026431718061676,' Create ': 0.0022026431718061676,' Mystery ': 0.0022026431718061676,' Treasure ': 0.0022026431718061676,' One ': 0.0022026431718061676,' Earth ': 0.0022026431718061676,' Moving '180: 76220317 0.0022026431718061676, 'Blow away': 0.0022026431718061676, 'Holding': 0.004405286343612335, 'Medium': 0.0022026431718061676, 'Storefront': 0.004405286343612335, 'Experience': 0.004405 286343612335, 'Meeting': 0.004405286343612335, 'Add': 0.004405286343612335, 'Schedule': 0.004405286343612335, 'Trial': 0.0022026431718061676, '': 0.0022026431718061676, '': 0.0022026431718061676, 'Special': 0.0022026431718061676, '180' 'Badge': 0.0022026431718061676, 'Random': 0.0022026431718061676, 'Distribution': 0.0022026431718061676, 'Number': 0.0022026431718061676, 'Limited': 0.0022026431718061676, 'Disappeared': 0.0022026431718061676, 'Order': 0.0022026431718061676, 'End': 0.0022026431718061676, ' ': 0.0022026431718061676,'】 ': 0.0022026431718061676,' Tokyo ': 0.0022026431718061676,' Metropolitan ': 0.0022026431718061676,' Ikebukuro ': 0.0022026431718061676,' Food&Drink ': 0.0022026431718061676,' Store ': 0.0022026431718061676,' KOEI ': 0.0022026431718061676,' TEC 0.0022026431718061676, 'CAFE': 0.0022026431718061676, '&': 0.0022026431718061676, 'DINING': 0.0022026431718061676, 'Collaboration': 0.0022026431718061676, 'Early': 0.0022026431718061676, ' Namu ': 0.0022026431718061676,' In-store ': 0.0022026431718061676,' Decoration ': 0.0022026431718061676,' Ya ': 0.004405286343612335,' Limited ': 0.0022026431718061676,' Menu ': 0.0022026431718061676,' Enjoy ': 0.0022026431718061676,' Details ': 0.00' 22026431718061676 : 0.0022026431718061676, 'Reservation': 0.0022026431718061676, 'Method': 0.0022026431718061676, 'etc.': 0.0022026431718061676, 'Later': 0.0022026431718061676, '©': 0.0022026431718061676, 'All': 0.0022026431718061676, 'rights': 0.0022026431718061676, 220 , '.': 0.0022026431718061676}}
In order to be able to display this even outside of a for statement, I created another empty dictionary and tried it with update. print (KF)
{1: {},
2: {},
3: {},
Four: {},
Five: {},
6: {},
7: {},
8: {},
9: {},
Ten: {},
11: {},
12: {},
13: {},14: {},
15: {},
16: {},
17: {},
18: {},
19: {},
20: {},
twenty one: {},
twenty two: {},
twenty three: {},
twenty four: {},
twenty five: {},
26: {},
~~ Omitted because it is longer ~~ 671: {},
672: {},
673: {},
674: {},
675: {},
676: {},
677: {},
678: {},
679: {},
680: {},
681: {},
682: {},
683: {},
684: {},685: {},
686: {},
687: {},
688: {},
689: {},
690: {},
691: {},
692: {},
693: {},
694: {},
695: {},
696: {},
697: {},
698: {},
699: {},
700: {},
701: {},
702: {},
703: {},
704: {},
705: {},
706: {},
707: {},
708: {},
709: {},
710: {}}
key has been updated, but value is blank. I think this is probably because of the double dictionary type, but I don't know how to solve it.
-
Answer # 1
Related articles
- i want to remove double quotes and commas when exporting with python
- python - about the follow-up operation of text update of pysimple gui
- [python] i want to automatically update and acquire tweets posted at any time using tweepy
- python - nested, nested dictionary processing
- python 3x - update processing and multi-process with pyqtgraph
- python - i want to register excel table data as a dictionary for each row
- python - how to list only specific values in a dictionary
- python - conditional statement when dictionary type data is not passed in django
- python - please tell me how to automatically update the temperature, humidity and barometric pressure display using bme280 on ra
- python 3x - python3 tkinter treeview data update
- python - how to use double loop, block placement
- python - i want to add an element to a double list
- python - how to store the characters in the list in the dictionary
- python - convnet weight update error
- python - how to output the key and value in the dictionary in any form
- python - i want to remove whitespace in dictionary values
- i want to use neologd dictionary in python
- [python] i want to convert text data to dictionary type or list type
- i want to combine multiple lists into one dictionary with python
- python - nested dictionary none replacement
Trends
Since UW and JE bind the same object, one change will propagate to the other.
Because it is a problem to reuse the same object, you can write as follows.
The same applies to WW and VV.