Movatterモバイル変換
[0]ホーム
Import confusion
Kristian Ovaskakristian.ovaska at helsinki.fi
Sat Apr 7 07:24:39 EDT 2001
----- m1.py -----from m2 import *setX(10)print x----- /m1.py --------- m2.py -----x = 0def setX(y):global xx = y----- /m2.py ----When I run m1, it prints 0. Why doesn't it print 10?----- m1b.py -----import m2m2.setX(10)print m2.x----- /m1b.py ----Now, this prints 10. I'm confused. Could someone explain what's goingon?-- Kristian Ovaska <kristian.ovaska at helsinki.fi>
More information about the Python-listmailing list
[8]ページ先頭