1 2 3 4 5 |
>>> def f(): ... from os import * ... File "<stdin>", line 1 SyntaxError: import * only allowed at module level |
import *はモジュールの先頭に書いて、モジュール単位で管理しましょう。
パイソンカーニバル。Pythonをはじめ、TypeScript、WindowsやMacなど、開発を楽しむ祭典。
1 2 3 4 5 |
>>> def f(): ... from os import * ... File "<stdin>", line 1 SyntaxError: import * only allowed at module level |
import *はモジュールの先頭に書いて、モジュール単位で管理しましょう。