亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標題:
python類的問題
[打印本頁]
作者:
kellyseeme123
時間:
2015-09-10 10:10
標題:
python類的問題
剛學(xué)python,問個簡單問題
我定義了一個類,那么我怎么引用呢?
[root@python testclass]# ls -l
total 8
-rw-r--r-- 1 root root 38 Sep 10 02:08 test.py
-rw-r--r-- 1 root root 270 Sep 10 02:09 test.pyc
[root@python testclass]# cat test.py
#!/usr/bin/python
class person:
pass
[root@python testclass]# python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> p=person()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'person' is not defined
>>> import test
>>> p=person()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'person' is not defined
>>> import test.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named py
復(fù)制代碼
作者:
kellyseeme123
時間:
2015-09-10 10:16
已經(jīng)解決。。p = test.person()
即可。。。。。
作者:
huang6894
時間:
2015-09-10 15:35
import test 而不是import test.py
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2