17 lines
416 B
Python
17 lines
416 B
Python
|
import re
|
||
|
import sys
|
||
|
|
||
|
inFile = sys.argv[1]
|
||
|
outFile = sys.argv[2]
|
||
|
|
||
|
with open(inFile, "r", encoding="utf-8") as sampleCheck, open(outFile, 'w', encoding='utf-8') as outputFile:
|
||
|
pattern = re.compile(r'\b\d+\b')
|
||
|
|
||
|
for line in sampleCheck:
|
||
|
matches = re.findall(pattern, line)
|
||
|
|
||
|
if matches:
|
||
|
result = ' '.join(matches)
|
||
|
outputFile.write(result + '\n')
|
||
|
print(result)
|