Basic python string " "question

Hi guys,
can you please tell me how to pass 10’6" as a string in python?
" 10’6" " doesn’t work…:frowning:

You need to escape the ’ and " characters. This is typical to most programming languages. You can do this by adding a backslash before the quotation marks like so…

myString = "10 \'6 \""

See how the backslashes are before any quotation marks you want to keep in the string? This tells the compiler to ignore these when building the string otherwise the compiler will see these as the end of your string.

https://docs.python.org/2.0/ref/strings.html

4 Likes