📜  python c like struct - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:51.207000             🧑  作者: Mango

代码示例2
from dataclasses import dataclass


@dataclass
class Point:
    x: float
    y: float
    z: float = 0.0


p = Point(1.5, 2.5)

print(p)  # Point(x=1.5, y=2.5, z=0.0)