Answers for "string literals python"

11

r string python

# a Rstring is a string that treat backslashs as normals caracters
#Exemple:
#normal string
>>> print("This is a line feed : n and it's usefull!")
This is a line feed :
and it's usefull!
# R-string
>>> print(r"This is not a line feed /n :(")
This is not a line feed /n :(
 
# It's mostly used to write Paths
# Exemple
my_path = "C:UsersMeDesktopMyFile.txt" #Don't works a all but
my_path = r"C:UsersMeDesktopMyFile.txt" #Totaly work!
Posted by: Guest on June-22-2020
0

python literal string

>>> r'abcdevt' # Use the r prefix
# Result:
'abc\dev\t'
Posted by: Guest on June-09-2021
0

python literal string

String literal is a datatype in python.
which is used to store characters of variable length
For example :-
  a = 'This is a string'
  b = 'You can also includes these @#$%^&*( or 12345678'
Above there are two variables a and b having string literal as there values
Posted by: Guest on March-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language