title: Why can't import os; precede this in python3 terminal in a single line?
body: <p>I know I used to do it but now I can't remember so I try <code>import os; for f in os.listdir('dirname'): os.rename(f, f.replace('somestring', ''))</code> and get syntax error.</p>
  
  <p>It seems I can type <code>import os; print("ok")</code> ok but if I try <code>import os; for f in os.listdir('.'): print(f)</code> it's invalid syntax, and if I leave out the <code>import os;</code> I get an ellipsis with or without a closing <code>;</code> </p>