Apr-20-2019, 10:23 PM
I don't know exactly what you're trying to do but if you're trying to put each of these in a dictionary and give them the 1. This is how you would do that -
x = [("GOOGL", 125, 772.88, 941.53), ("MSFT", 85, 56.60, 73.04), ("RDS-A", 400, 49.58, 55.74), ("AIG", 235, 54.21, 65.27), ("FB", 150, 124.31, 172.45)] mydata = {} for i in x: for f in i: mydata.update({f : 1}) print(mydata)
Output:{'GOOGL': 1, 125: 1, 772.88: 1, 941.53: 1, 'MSFT': 1, 85: 1, 56.6: 1, 73.04: 1, 'RDS-A': 1, 400: 1, 49.58: 1, 55.74: 1, 'AIG': 1, 235: 1, 54.21: 1, 65.27: 1, 'FB': 1, 150: 1, 124.31: 1, 172.45: 1}