Home>
The list is as follows.
list = [(1,'Tokyo', 4), (3,'Tokyo', 6), (2,'Osaka', 9), (7,'Kobe', 10), (4,'Kobe', 8)]
They are sorted by group as list.sort (key = itemgetter (1)).
In this list
Number of cities(Tokyo: 2, Osaka: 1, Kobe: 2)
How to get the city name(For example, how to find out that there are Tokyo, Osaka, Kobe groups in this list)
I want to know.
I will add the missing information, so please leave a comment.
-
Answer # 1
Related articles
- python 3x - how to count the number of data extracted by pandas or how to solve the error
- python - i want to make a total value of channels with multiple images
- python - when you want to judge by the number of characters from the back with a regular expression
- python - how to get the number of searches for a specific word within the period
- python - sumy by specifying the maximum number of characters with sumy
- python - i want to add a line number to the data frame
- number of python combinations
- python - i want to divide a binary number into two, store it in a list, and represent it in a different decimal number
- python 3x - i want to output the name corresponding to the number entered in the excel file
- python - valueerror: field'id' expected a number but got'suzukitadashi'
- i want to invert the number 12345 in python like 54321 and display it
- get the number of characters from the python text box
- how to align the number of elements with overlaplengt of python etc
- set python excel serial number to date and time
- how to multiply each element by a number in a python 2d list
- where is the minor version number of python that starts by default specified?
- python - how to accept number input even if keypressevent is defined for qlineedit in pyside
- php - please tell me how to display the total number of refined searches
- python - i want to output the total amount on the pos system
Trends
As an example, it will be easier if you handle it by putting it back in the dictionary of "city = number".
Type (dictionary)-Python3
This is an execution example.