代码如下:
#encoding=utf-8
print '中国'
#添加 修改一系列已经命名的参数 用于搜集一系列元素,然后重命名
#每个类都有一个内置的字典
class bunch(object):
def __init__(self,**kwds):
self.__dict__.update(kwds)
x=10
y=120
threshold=140
setitems=bunch(data=y,squared=y*y,coord=x)
if setitems.squared > threshold:
print x
y=1
setitems.squared=10
if setitems.squared < threshold:
print x
打印结果如下:
中国
10
10
阅读全文