def StudentInfo(country='中国', name):

    print('%s,%s' % (name, country))


StudentInfo('美国', '大卫')

原因:SyntaxError: non-default argument follows default argument

def StudentInfo(country='中国', name):

^

def StudentInfo(name, chineselevel='良好', country='中国'):
    print('姓名:%s,中文水平:%s,国家:%s'%(name,chineselevel,country))
StudentInfo(name='大卫', '良好', '美国')

上述代码报错:

原因:SyntaxError: positional argument follows keyword argument

StudentInfo(name='大卫', '良好', '美国')

^

相关文章:

  • 2022-12-23
  • 2022-02-10
  • 2021-09-03
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-13
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案