lines = [x.strip() for x in open('dataset/NationalNames.csv', 'r').readlines()][1:] of = open('dataset/names.txt', 'w') for line in lines: of.write(line.split(',')[1]) of.write('\n')