Python: How to read lines How to write lines (Python)
Dec 222009

When you want to find a word in a string, use find()

e.g.

import sys
arg1 = sys.argv[1] # passing the first argument

if arg1.find("off") == -1: # if arg1 does not contain "off"
# do something
else:
# do something

Posted by weboom at 2:36 pm Tagged with: ,

Leave a Reply

(required)

(required)

Switch to our mobile site
Top Footer