码迷,mamicode.com
首页 > 其他好文 > 详细

collections模块

时间:2018-12-23 23:50:23      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:from   int   模块   __init__   ber   card   elf   bsp   init   

 

 

 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)

 

collections模块

标签:from   int   模块   __init__   ber   card   elf   bsp   init   

原文地址:https://www.cnblogs.com/Mengchangxin/p/10166024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!