read csv file



    Python public recipes

    Read a CSV file in Python

    Regular read CSV file with the CSV library

    For each line, use line["attributeName"] to access the content.


    import csv
    with open(file_name, mode ='r', encoding='utf-8') as file:
      # reading the CSV file
      csvFile = csv.DictReader(file)
      # displaying the contents of the CSV file
      for line in csvFile:
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.