Python实现结构体代码实例
作者:xushukui 时间:2023-08-22 09:59:44
这篇文章主要介绍了Python实现结构体代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
# python 使用类创建结构体
class Myclass(object):
class Struct(object):
def __init__(self, name, age, job):
self.name = name
self.age = age
self.job = job
def make_struct(self, name, age, job):
return self.Struct(name, age, job)
myclass = Myclass()
test1 = myclass.make_struct('xsk', '22', 'abc')
test2 = myclass.make_struct('mtt', '23', 'def')
print test1.name
print test1.age
print test1.job
print test2.name
print test2.age
print test2.job
来源:https://www.cnblogs.com/nyist-xsk/p/10470527.html
标签:Python,实现,结构,体
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
asp+XMLHTTP的国际域名查询系统(whois)源代码
2008-02-16 09:23:00
百度首席设计师 用户体验部总监郭宇演讲
2008-09-03 12:41:00
sql 多条件组合查询,并根据指定类别找出所有最小子类别的SQL语句备忘
2024-01-20 09:01:50
Python读取excel文件中的数据,绘制折线图及散点图
2023-09-12 11:47:31
![](https://img.aspxhome.com/file/2023/3/105363_0s.png)
ASP连接MySQL数据库的方法
2010-03-14 11:25:00
Django处理多用户类型的方法介绍
2022-11-30 10:16:54
![](https://img.aspxhome.com/file/2023/3/85033_0s.png)
ASP环境中使用QQ纯真版IP数据库QQWry.dat
2010-02-26 13:35:00
python绘制浅色范围曲线的示例代码
2021-07-03 02:34:10
![](https://img.aspxhome.com/file/2023/0/127020_0s.png)
python操作摄像头截图实现远程监控的例子
2022-01-04 19:59:42
python聚类算法选择方法实例
2023-12-01 13:51:11
jQuery+php简单实现全选删除的方法
2023-11-05 20:23:38
8大措施帮你构筑Access安全防线
2010-03-11 14:38:00
python生成lmdb格式的文件实例
2021-07-18 21:57:05
Python不使用int()函数把字符串转换为数字的方法
2022-04-22 02:32:33
Opencv图像处理:如何判断图片里某个颜色值占的比例
2023-09-27 16:57:40
Python学习之自定义异常详解
2021-05-05 18:46:20
JavaScript实现彩虹文字效果的方法
2024-06-05 09:34:41
ASP 循环导入导出数据处理 不使用缓存
2010-07-02 12:31:00
lambda 表达式导致 Arthas 无法 redefine 的问题
2023-08-25 18:05:05
![](https://img.aspxhome.com/file/2023/9/131779_0s.png)
Django实现跨域的2种方法
2021-11-27 00:15:42