0

I have encountered a weird typo interpretations using Escape sequence in data entered by user, please help to find out why?

Statement 1: >>>input("Enter Data: ") Enter Data: Hi\n\"Gaurav\" 'Hi\\n\\"Gaurav\\"' Statement 2: >>>c = input("Enter Data: ") Enter Data: Hi \n\"Gaurav\" >>>print(c) Hi\n\"Gaurav\" in Statement 1 when the user also entered escape character It is interpreted as Double backslash,why? in statement 2: It is supposed to be enter new line or double quotes but it doesn't why?

15th Jan 2017, 7:49 AM
Gaurav
Gaurav - avatar
2 Réponses
+ 1
Interesting .. sorry idk tho
15th Jan 2017, 8:51 AM
Badmephisto
Badmephisto - avatar
0
yup python is much weird than c
15th Jan 2017, 9:48 AM
Gaurav
Gaurav - avatar