Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
toanh tran9,083 Points
Data Science Basic. I can't figure out what is wrong with my code. Please review. I get the Bummer! Try again.
Challenge Task 2 of 2
Now that you have the csv module imported, write a function named open_with_csv that takes one argument, a string with a file name. Within open_with_csv, assign an empty list to a variable named data. Return the value of data.
import csv def open_with_csv(filename, d='\t'): data =  with open(filename, encoding='utf-8') as tsvin: tsvin = csv.reader(tsvin, delimiter=d) for row in tsvin: data.append(row) return data
Ken AlgerTreehouse Teacher
This challenge is rather explicit in what it wants. You have some extra code in there that it is not expecting to see which alters the data.
Post back if you are still stuck.
import csv def open_with_csv(filename, d='\t'): data =  return data