Professional Documents
Culture Documents
Python For Og Lecture 3 Escape Sequences and Raw String
Python For Og Lecture 3 Escape Sequences and Raw String
Website - https://petroleumfromscratchin.wordpress.com/
LinkedIn - https://www.linkedin.com/company/petroleum-from-scratch
YouTube - https://www.youtube.com/channel/UC_lT10npISN5V32HDLAklsw
print("Hello 'World'")
Hello 'World'
print('Hello "World"')
Hello "World"
But YOU CANNOT use " " inside " " AND
print('Hello 'World'')
https://colab.research.google.com/drive/1PGymurQiToFexJ6xalFSNB3EhX8mmGZa#printMode=true 1/6
1/28/2021 Python for O&G Lecture 3 - Escape Sequences and Raw String - Colaboratory
print("Hello "World"")
print('I'm Divyansh')
Escape Sequences
https://colab.research.google.com/drive/1PGymurQiToFexJ6xalFSNB3EhX8mmGZa#printMode=true 2/6
1/28/2021 Python for O&G Lecture 3 - Escape Sequences and Raw String - Colaboratory
# New section
# \" - "
print('I\'m Divyansh')
I'm Divyansh
print("Hello \"World\"")
Hello "World"
print('Line 1')
print('Line 2')
Line 1
Line 2
Line 1
Line 2
print('name:\tDivyansh')
print('age:\t24')
name: Divyansh
age: 24
\b Backspace
print('Divyana\bsh')
Divyansh
Double backslash
print(' \\ ')
\\
\\\\
Line 1 \n Line 2
# \\n
# \\ - \
# n - n
# \\n - \n
https://colab.research.google.com/drive/1PGymurQiToFexJ6xalFSNB3EhX8mmGZa#printMode=true 4/6
1/28/2021 Python for O&G Lecture 3 - Escape Sequences and Raw String - Colaboratory
" '
\" \'
# \\ - \
# \" - "
# \\\" - \"
\" \'
Assignment 1
# My name is 'Divyansh'
# I am 24 years old
# I love the color 'Blue'
My name is 'Divyansh'
I am 24 years old
I love the color 'Blue'
https://colab.research.google.com/drive/1PGymurQiToFexJ6xalFSNB3EhX8mmGZa#printMode=true 5/6
1/28/2021 Python for O&G Lecture 3 - Escape Sequences and Raw String - Colaboratory
https://colab.research.google.com/drive/1PGymurQiToFexJ6xalFSNB3EhX8mmGZa#printMode=true 6/6