Python Forum
Converting List of 3 Element Tuple to Dictionary
Thread Rating:
  • 3 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting List of 3 Element Tuple to Dictionary
#1
I have one 3d list of tuple

list=[(0, 1, 6), (5,1,4), (1, 6, 0), (3, 2,1),(4,5,1)]
I want to add in a dictionary like this:

{ (0,1,6): 2,
  (4,5,1): 2,
  (3,2,1): 1 }
I want to count the similar tuples.

Any suggestions?
Reply


Messages In This Thread
Converting List of 3 Element Tuple to Dictionary - by fooikonomou - Jan-10-2019, 03:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  using > < for tuple , list,... akbarza 3 399 Feb-05-2024, 01:18 PM
Last Post: deanhystad
  Dictionary in a list bashage 2 493 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  filtering a list of dictionary as per given criteria jss 5 597 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  Searche each element of each tuple based 3 numbes zinho 8 778 Dec-11-2023, 05:14 PM
Last Post: zinho
  Sort a list of dictionaries by the only dictionary key Calab 1 452 Oct-27-2023, 03:03 PM
Last Post: buran
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 426 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  list in dicitonary element problem jacksfrustration 3 625 Oct-14-2023, 03:37 PM
Last Post: deanhystad
  Change font in a list or tuple apffal 4 2,632 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
  How to add list to dictionary? Kull_Khan 3 951 Apr-04-2023, 08:35 AM
Last Post: ClaytonMorrison
  Find (each) element from a list in a file tester_V 3 1,155 Nov-15-2022, 08:40 PM
Last Post: tester_V

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020