python报错

Traceback (most recent call last):
  File "/Users/denglin/software/workspace/pycharmworkspace/pycharm2018/ch4/sparksamples/test.py", line 1, in
    from ch4.sparksamples import util
  File "/Users/denglin/software/workspace/pycharmworkspace/pycharm2018/ch4/sparksamples/util.py", line 19
    def get_user_data():
    ^
SyntaxError: import * only allowed at module level

 

python报错_第1张图片

原因是在python方法中引入了

python报错_第2张图片 import *

把import * 放入方法外面就行了

你可能感兴趣的:(Python)