Skip to content

Python code snippet – How to read first column of csv intro a list ?

with open("mylist.csv") as f:
    list2 = [row.split()[0] for row in f]
See also  Python code snippet - How to replace string in list ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.