I am trying to match a text in a file
In [44]: with open(path) as f:
....: for line in f:
....: matched = re.search('^PARTITION BY HASH',line)
....: if matched is not None:
....: print matched.group()
....:
The file contains lines like PARTITION BY HASH(SOME_THING); And also some other lines among which there is SUBPARTITION BY HASH(SOME_THING) which shouldn't be matched
After the match i would like to delete that line. But the print matched.group fails why ?
rehere? just doif "PARTITION BY HASH" in lineorif line.startswith("PARTITION BY HASH"):