blob: 25634f534ed52c675de1a82d4e733e70ee4d902e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env python3
import sys
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('file', nargs=1, type=str)
parser.add_argument('text', nargs=1, type=str)
args = parser.parse_args()
text = args.text[0]
with open(args.file[0], 'r', encoding='utf-8') as f:
for line in f:
if line.strip() == text:
return 0
return 1
if __name__ == '__main__':
sys.exit(main())
|