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 trial

Python Data Science Basics Describing Data Loading Raw Data

delimiter problem

I have duplicated the code in this video (below). When I run the code I get this error:

tie_reader = csv.reader(tsvin, delimiter=d)

TypeError: "delimiter" must be a 1-character string

code:import csv def open_with_csv(filename, d='/t'): data = [] with open(filename, encoding='utf-8') as tsvin: tie_reader = csv.reader(tsvin, delimiter = d)
for line in tie_reader: data.append(line) return data

data_from_csv = open_with_csv('data.csv') print(data_from_csv[0])

Thanks for any help

yea i found it..need more coffee ty

1 Answer

You have a forward slash instead of a backslash

d='/t'

should be

d='\t'