Generation

generate functionFri, 17 Mar 2023

open file and grep selected word lines and write to files

def grep(file, word): f = open(file, 'r') for line in f: if word in line: print(line) f.close() grep('file.txt', 'string')

Questions about programming?Chat with your personal AI assistant