Python 练习范例 87
回答结果 ( 结构体变量传递 )
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': class student: x = 0 c = 0 def f(stu): stu.x = 20 stu.c = 'c' a= student() a.x = 3 a.c = 'a' f(a) print a.x,a.c
以上 Python 代码输出结果如下
20 c
回答结果 ( 结构体变量传递 )
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': class student: x = 0 c = 0 def f(stu): stu.x = 20 stu.c = 'c' a= student() a.x = 3 a.c = 'a' f(a) print a.x,a.c
以上 Python 代码输出结果如下
20 c
♥ 简单教程,简单编程 - IT 入门首选站
Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.