Reputation: 131
I am attempting to parse through a string to look for all slashes in the string but cannot close out the parenthesis.
for i in string:
if i == '\':
do_something
It wants to treat the \' as one character. Is there a way to nullify that?
Upvotes: 0
Views: 53
Reputation: 8446
You need to escape the backslash character with another backslash.
for i in string:
if i == '\\':
do_something
Upvotes: 8