Dec-18-2018, 01:25 PM
This is a problem:
for row in file1_data: x = file1_data.index(row) file1_list.append(file1_data[x][1])The second line is constantly searching through the list. My first thought was that it's much better to use enumerate:
for x, row in enumerate(file1_data): file1_list.append(file1_data[x][1])But then I read the third line. file1_data[x] is row. They're the same thing. Why go to all that trouble?
for row in file1_data: file1_list.append(row[1])Which is so simple it might as well be a list comprehension:
file1_list = [row[1] for row in file1_data]
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures