+ 3
Difference between input and raw input in python
2 Answers
+ 5
raw_input()Â â It reads the input or command and returns a string.
input()Â â Reads the input and returns a python type like list, tuple, int, etc.
for more info visitđ
https://www.geeksforgeeks.org/difference-between-input-and-raw_input-functions-in-python/
+ 2
Regardless of input of string or raw string, we can create raw string explicitely.
this is a regular string in python 3.x:
txt = 'to get a new line in string output, we can include a \n to achieve this'
if we print txt, output is (\n is interpreted as new line) :
to get a new line in string output, we can include a
to achieve this
to print the text as it was created, we can use a raw string by using 'r' like:
txt1 = r'to get a new line in string output, we can include a \n to achieve this'
the output of txt1 is now:
to get a new line in string output, we can include a \n to achieve this