69pao国产精品视频-久久精品一区二区二三区-精品国产精品亚洲一本大道-99国产综合一区久久

Python 練習(xí)實(shí)例87

python 練習(xí)實(shí)例87

python 編程100例python 編程100例

題目:回答結(jié)果(結(jié)構(gòu)體變量傳遞)。

程序分析:無(wú)。

程序源代碼:

#!/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

以上實(shí)例輸出結(jié)果為:

20 c

python 編程100例python 編程100例

下一節(jié):python 練習(xí)實(shí)例88

python 編程100例

相關(guān)文章