Sunday 28 October 2018

Short way to write or in python

I have this code:



table is a list.




if 'ping' in table or 'pong' in table:
# Do something here


Is there a shorter way to write this?
I don't want to have table duplicated in the if statement.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...