I'm attempting to load a CSV which looks like the following and create a tuple out of it, so that I can later access account1, account2, etc in code:
user,password
[email protected],password
[email protected],password2
So far, all I've been able to do is import the CSV.
import csv
# our csv file name
filename = "resources/accounts.csv"
with open(filename) as infile:
reader = csv.reader(infile)
I'm looking for something like so: {("[email protected]", "password"), ("[email protected]", "password")}
Could someone advise on what to do from here?
(('[email protected]', 'password'), ('[email protected]', 'password'))— with:tuple_of_tuples = tuple(row for row in csv.reader(infile)).