Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to understand have it been \n in input or not
ex: if "hello \n hru" print true
else print false
totally I want to know python how to read \ and \n ..
Python
I=0 
if s[I]=="\" and s[I+1]==\n ...

it s not correct
i dont know how to solve it !!!!

What I have tried:

s="salam\n"
i=len(s)
print(i)
if (s[i-1] ==" " and s[i-2]==' '):
    print(1==1)
    print(i-1)
Posted
Updated 30-Apr-20 8:27am

1 solution

You need to read documentation !
Python Escape Characters[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900