Hi. Here is some code:
if (message.value[0] == "/" or message.value[0] == "\"):
do stuff.
I'm sure it's a simple syntax error, but something is wrong with my if statement. Any ideas to help out a python newbie?
Cheers
Hi. Here is some code:
if (message.value[0] == "/" or message.value[0] == "\"):
do stuff.
I'm sure it's a simple syntax error, but something is wrong with my if statement. Any ideas to help out a python newbie?
Cheers
Escape the backslash:
if message.value[0] == "/" or message.value[0] == "\\":
From the documentation:
The backslash (\) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.
Try like this:
if message.value[0] == "/" or message.value[0] == "\\":
do_stuff
when you check for equality, you can also simply do this:
if message.value[0] in ( '/', '\\' ):
do_stuff