Guys help will be very grateful, I suffer for 2 days, I am a beginner in Python There is a csv file:
Pink Floyd | The Dark Side Of The Moon | 1973 | psychodelic rock | 43:00 Eminem | Recovery | 2007 | rap | 21:00 The task is to create a list,
It is necessary to create a tuple in which there will be 2 more tuples. In the first tuple - the name and in the second tuple - information. All external tuples must be in one big list. After that, you will need to find different elements from the list by name and show all the information of this element.
Example:
music = [(("Pink Floyd", "The Dark Side Of The Moon"), (1973, "psychodelic rock", "43:00")), (("Britney Spears", "Baby One More Time"), (1999, "pop", "42:20"))] Here is what I am trying to do:
import csv with open('music.csv', 'r') as f: read_csv = csv.reader(f, delimiter="|") read_csv music = [] for row in read_csv: music.append(row) Lists out in the list
[['Pink Floyd ', ' The Dark Side Of The Moon ', ' 1973 ', ' psychodelic rock ', ' 43:00'], ['Eminem ', ' Recovery ', ' 2007 ', ' rap ', ' 21:00']] How to insert these two tuples and take them into one common tuple? and how to search further for words on tuples?