命名元组

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)

  

猜你喜欢

转载自www.cnblogs.com/work14/p/10187678.html