As the title says. An article like I wrote in 10 minutes. Take the first line of the CSV file and split (',') and return it. that's all.
Foreshadowing ... maybe?
def get_lines_from_textfile(filepath):
with open(filepath, 'r', encoding='utf-8') as f:
lines = f.readlines()
return lines
def get_columns_list(csvpath):
line_1st = get_lines_from_textfile(csvpath)[0]
return line_1st.split(',')
def main():
csvpath = 'solubility.test.csv'
columns = get_columns_list(csvpath)
for column in columns:
print(column)
if __name__ == '__main__':
main()
nothing special.