Why can't the import command be found?
问题 I am using the input function from fileinput module to accept script via pipes or input file Here is the minimum script: finput.py import fileinput with fileinput.input() as f: for line in f: print(line) After making this script executable, I run ls | ./finput.py and get unexpected error message ./finput.py: line 1: import: command not found ./finput.py: line 3: syntax error near unexpected token `(' ./finput.py: line 3: `with fileinput.input() as f:' The only fix I found is when I add #!/usr