-2

I have a CSV file with a list of names in it that I want to modify and return a list of. What is the best way to import the CSV, loop through my function, and return a list with all of the modified names?

Thanks!

  • 1
    https://docs.python.org/2/library/csv.html will be helpful. Do you have a more specific question? – Evan Weissburg Sep 09 '17 at 01:50
  • Thanks for the response Evan, you're right, I should have been much clearer. Basically I have a for loop that modifies every letter in a string - but I am having difficulty importing the .csv file and getting the for loop to work for every string in the file. I wanted to learn more about what the proper syntax of that function would look like and how the code should be structured. Any help you could give would be great. – Tony B. Sep 09 '17 at 02:20

1 Answers1

0
import csv
with open('your_csv.csv','r', encoding='utf-8') as file:
    reader = csv.reader(file)
    your_list = [row for row in reader]
Hisagr
  • 601
  • 6
  • 13