-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!

2
  • 1
    docs.python.org/2/library/csv.html will be helpful. Do you have a more specific question? Commented Sep 9, 2017 at 1: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. Commented Sep 9, 2017 at 2:20

1 Answer 1

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]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.