getting random gaps in my print statements python
Question:
I am trying to print a statement in python and getting gaps and missing letters, this only happens when I use "". I was trying to enter the path.
image
check the image
I am using vs code, anaconda, Jupiter notebook
Answers:
The t
in your string is an escape character which translates to a tab. In order to ignore the escape characters you can use raw strings by placing an r
before the string. Examples:
print("aatbb")
aa bb
With raw strings:
print(r"aatbb")
aatbb
Happening because in dogtrain
, t
is being considered as Tab escape character.
to fix it, simply put another
in front of ‘t’ \t
.
I am trying to print a statement in python and getting gaps and missing letters, this only happens when I use "". I was trying to enter the path.
image
check the image
I am using vs code, anaconda, Jupiter notebook
The t
in your string is an escape character which translates to a tab. In order to ignore the escape characters you can use raw strings by placing an r
before the string. Examples:
print("aatbb")
aa bb
With raw strings:
print(r"aatbb")
aatbb
Happening because in dogtrain
, t
is being considered as Tab escape character.
to fix it, simply put another in front of ‘t’
\t
.