I am trying to process the contents of a file. I need ideas as to how to interact with the user and to wait for a press of a key (s) to write the current line into another file. Thank you in advance.
with open(srcFile) as f:
line = f.readline().strip()
#- do something with line
#- part where I need help
if s is press, write the current line to file
if s is not pressed after 5 seconds, continue with the next line in srcFile