w*s 发帖数: 7227 | 1 want to see if "ads" is in this line, but don't want to see "adsk".
so "ads abcde" is good
"adsk abcde" is bad
for now my code is like this,
for line in lines:
if (my_word+"\s" in line):
my_word is either "ads", or "adsk"
it's not even reporting "ads".
how to fix it pls ? | c********1 发帖数: 421 | 2 import re;
hasAds = re.compile(r"ads[^k]")
for line in lines:
if (hasAds.match(line) is not None):
...... |
|