Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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'