dictionary tag

93 questions


1 answers
57 views
0
Data reference between files

For example, at A.pyI'm going to continue scrolling through the web with a repetitive phraseStore the data in a dictionary variable (the data in the variable continues to be updated).) B.py is program...

1 years ago

1 answers
126 views
0
[python] Formatting only floating numbers among Dictionary values

I'm a beginner at Python. ;;;;;;I received data from two places through API and coded it with Python.One of them is a string as shown{A:TEST, B: 121212.146466}One place is a dictionary as shown below{...


1 answers
93 views
0
I need help with the Python list output.

I was happy that the answer came out earlier, but I came back to the starting point and posted the question again...The question now is, is it an address book in which you save the information of 3 fr...

1 years ago

1 answers
69 views
0
What is the difference between dict.items() and dict.iteritems()?

What is the difference between dict.items() and dict.iteritems()?From Python docs That's what they said. I turned the chords aroundThey return references to the same objectIs there anything I forgot?d...

1 years ago

1 answers
99 views
0
I'd like to process and print out the result value of the dictionary.

** Character winning rate **a : [4, 1, 0.8]b : [6, 4, 0.6]c : [0, 1, 0.0]d : [5, 8, 0.38] print(** character winning rate**)for k,v in character_list3.items() : print(k,':',v)I printed it out using th...

1 years ago

1 answers
96 views
0
How do I arrange dict in key order?

{2:3, 1:89, 4:5, 3:0 ->{1:89, 2:3, 3:0, 4:5}How do I arrange it in key order?In other articles, everyone returns the tuple with the ordered value.I need a dict, not a tuple

1 years ago

2 answers
100 views
0
The key and value of the Python dictionary keep changing.

for _ in range(NUM_OF_STRING): sortedDict[_] = {str(string[_]), sortIndexArr[_]}for __ in range(NUM_OF_STRING): print(sortedDict[__])This is the code, and if you run it,{0, ['P', 'S', 'R', 'S', 'P', '...

1 years ago

2 answers
144 views
0
Python mapping basic questions

calories={ 'Flour': 364, 'Pepper': 20.1, Olive: 115, Pork: 242.1}def Calories (name,kcal): return calories.get(name)*kcal//100print (calories ('pork',500))print (calories (beef, 500))Here, the result ...

1 years ago

1 answers
114 views
0
Convert items in the Python list to dictionary

a=[Seoul, Seoul, Gyeonggi, Gyeonggi, Incheon, Incheon]dic={0: 'Seoul', 1: 'Seoul', 2: 'Gyeonggi', 3: 'Gyeonggi', 4: 'Incheon', 5: 'Incheon'} How do I change from a to dic?

1 years ago

1 answers
92 views
0
I'm looking for a function to erase all the contents in the folder

I'm looking for a function to erase all the contents in the folderI looked it up, but os.rmdir() can only erase empty directories (although I can recursively call and create them myself).I want to kno...

« - 4 - »

© 2024 OneMinuteCode. All rights reserved.