Python Forum
Introduction to escaping characters in strings - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: General Coding Help (https://python-forum.io/Forum-General-Coding-Help)
+--- Thread: Introduction to escaping characters in strings (/Thread-Introduction-to-escaping-characters-in-strings)



Introduction to escaping characters in strings - Geelong_crazy - Jul-18-2020

Hey, brand new to coding so please help out with the fundamental.

I am trying to fix this up, please show me what I am supposed to do

print('I/m learning Python!')
print("A number enclosed in double quotes: "42"")

What is it I need to change??

Thanks!


RE: Introduction to escaping characters in strings - DT2000 - Jul-18-2020

First and foremost please put your code in tags.
print('I/m learning Python!')
print("A number enclosed in double quotes: "42"")
Then provide what you have already tried so you can be pointed in the direction that would best help you learn and understand.
Also, be clear about your query... what is it you are trying to do and how are you going about it.

Regarding the printing of the two lines you need to learn the point of quotations when printing a string.
If you are trying to show a piece of the string in quotes you need to change the initial quotation marks used to single ' instead of " so they do not conflict.
print('A number enclosed in double quotes: "42"')
And the first string:
print("I'm learning Python!")
When writing code I personally use single quotes for most things and double quotations when needed in a string or other function.