collections模块

 https://www.cnblogs.com/Eva-J/articles/7228075.html

 http://www.cnblogs.com/Eva-J/articles/7291842.html

 1 from collections import namedtuple
 2 # Point=namedtuple('point',['x','y'])
 3 # p1=Point(1,2)
 4 # print(p1)
 5 #
 6 # Card=namedtuple("扑克牌",['suits','number'])
 7 # c1=Card("黑桃",3)
 8 # print(c1)
 9 #
10 # Circle=namedtuple('圆',['x','y','r'])
11 # c11=Circle(1,2,5)
12 # print(c11)
13 # print(type(c11))
14 class 圆:
15     def __init__(self,x,y,r):
16         self.x=x
17         self.y=y
18         self.r=r
19     # def __str__(self):
20     #     return
21 c22=圆(1,2,3)
22 print(c22)

 

posted @ 2018-12-23 22:32  巨兽~墨菲特  阅读(116)  评论(0编辑  收藏  举报