命名元组

from collections import namedtuple

# # 类
# p = namedtuple("Point", ["x", "y","z"])
# # 对象
# p1 = p(10, 20,30)
# print(p1)
#
# print(p1.x)
# print(p1.y)

# car = namedtuple("Car", ["pai", "color", "pailiang"])
# c = car("京C-10000", "绿色", "1.8T")
# print(c)
#
# import time
# print(time.localtime())

# class Point:
#     def __init__(self, x, y):
#         self.x = x
#         self.y = y
# Point(10,20)

  

posted on 2018-12-27 21:54  =.===  阅读(170)  评论(0编辑  收藏  举报

导航