为什么运行报错无效的语法呢
我的这一行怎么有问题的呢print response1.getcode()
我的这一行怎么有问题的呢print response1.getcode()
2018-07-19
使用的是python3而且print语句也是添加了括号,代码与报错如下
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def print_scores(**kw):
print(' Name Score')
print('------------------')
for name, score in kw.items():
print('%10s %d' % (name, score))
print()
print_scores(Adam=99, Lisa=88, Bart=77)
data = {
'Adam Lee': 99,
'Lisa S': 88,
'F.Bart': 77
}
print_scores(**data)
def print_info(name, *, gender, city='Beijing', age):
print('Personal Info')
print('---------------')
print(' Name: %s' % name)
print(' Gender: %s' % gender)
print(' City: %s' % city)
print(' Age: %s' % age)
print()
print_info('Bob', gender='male', age=20)
print_info('Lisa', gender='female', city='Shanghai', age=18)
举报