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
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
In linux and unix, find command is very powerful command
the reasons are (from my opinions)
1. in linux, unix, every configurations are done in text
2. if you know some strings, you may want to find a file containing those strings
3. this will be extremely helpful when you work with linux system
$find . -exec grep “stringyouwanttofind” ‘{}’ [...]
