Latest web development tutorials

Python obejmuje ćwiczenia 87

Python 100 Li Python 100 Li

Tytuł: Odpowiedzi (struct bezstopniową przekładnię).

Program Analysis: Brak.

Kod źródłowy:

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

Powyższy przykład wyjście jest:

20 c

Python 100 Li Python 100 Li