Latest web development tutorials

Pythonは演習87を含み、

Pythonの100リー Pythonの100リー

タイトル:レスポンス(可変トランスミッションを構造体)。

プログラム解析:なし。

ソースコード:

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

上の例の出力は、次のとおりです。

20 c

Pythonの100リー Pythonの100リー