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 Python Basics (2015) Python Data Types Strings

What is the purpose of using different quote marks? (', ", etc)

Is there any significance/difference? Or is this choice purely aesthetic?

1 Answer

Diego Holt: Some languages the significance of the double vs. single quotes does matter. There's also a difference between using the single quote mark in the tilde button (above the tab button and next to the 1 on a Windows keyboard) and the single quote mark next to the enter key: ' . I've jumped around enough that I can't quite recall with Python, but I do remember that you have to think about potential problems like apostrophes and such. It's also good to be consistent in terms of once you choose a quote type, stick with that throughout the code.

So here's 2 examples:

"Moriarty told Sherlock, "Baby you should see me in a crown!" <--This would cause a problem because there are 2 starting quote marks

'I wasn't about to help you, but that's how it's gotta be.' <--this will cause a problem for the same reason

Craig goes into a break technique in a future video that allows you to create an apostrophe without having the problem.