As a beginner python programmer, I am hoping this is some stupid error (or lack of understanding) that has an simple solution:
/tmp> python3 -c 'with open("t","r") as f: for l in f: print(l)'
File "<string>", line 1
with open("t","r") as f: for l in f: print(l)
^
SyntaxError: invalid syntax
I can embed a newline in the oneline, but trying to understand why the above does not work
/tmp> python3 -c $'with open("t","r") as f:\n for l in f: print(l)'
Hi there