Follow me
-
Recent Posts
calendar
April 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Recent Comments
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
- Anonymous on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Wendy on gimp: how to make a transparent background
- Tanyo Ivanov on git : How to remove a big file wrongly committed
- Peter D. on How to use subprocess with PIPEs
Archives
Categories
Meta
Media RSS
Tag Archives: dictionary
How to sort a dictionary by values in Python
By definition, dictionary are not sorted (to speed up access). Let us consider the following dictionary, which stores the age of several persons as values: d = {"Pierre": 42, "Anne": 33, "Zoe": 24}d = {"Pierre": 42, "Anne": 33, "Zoe": 24} … Continue reading
python: how to merge two dictionaries
Let us suppose two dictionaries storing ages of different individuals: list1 = {"Pierre": 28, "Jeanne": 27} list2 = {"Marc": 32, "Helene": 34}list1 = {"Pierre": 28, "Jeanne": 27} list2 = {"Marc": 32, "Helene": 34} If you do mind losing the contents … Continue reading