def read_and_write(source, target): """Takes source file and target file, reads data from source file and is processed by iscommand function and written to target file.""" with open(source) as src: with open(target, "a") as tar: for line in src: contents = line.split() iscommand(contents, tar)
- def create a function to read and write the data from the source file and write the processed data to target file. - read_and_write takes two arguments source and target and returns nothing. - \t explanation of the code: def read_and_write(source, target): with open(source) as src: with open(target, "a") as tar: for line in src: contents = line.split() iscommand(contents, tar)