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! While you're at it, check out some resources Treehouse students have shared here.
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 trialtoanh tran
9,083 PointsData 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
3 Answers
Ken Alger
Treehouse TeacherToanh;
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.
Ken
Ary de Oliveira
28,298 Pointsimport csv
def open_with_csv(filename, d='\t'):
data = []
return data
toanh tran
9,083 PointsThanks! I figured it out. I was overthinking the solution.