PythonÈëÃŵÄ36¸öÀý×Ó Ö® 18
Àý1£º
# _018
# This is a module (if write Chinese in a module, there will be a error)
def func1():
print 'This is function 1.'
def func2():
print 'This is function 2.'
def func3():
print 'This is function 3.'
# 019
# ʹÓÓimport”Óï¾äµ÷ÓÃÄ£¿é£º
import _018_Module
_018_Module.func1()
_018_Module.func2()
_018_Module.func3()
output£º
This is function 1.
This is function 2.
This is function 3.
Àý2£º
# _018
# This is a module (if write Chinese in a module, there will be a error)
def func1():
print 'This is function 1.'
def func2():
print 'This is function 2.'
def func3():
print 'This is function 3.'
# 020
# ʹÓÓfrom ... import ...”Óï¾äµ÷ÓÃÄ£¿é
from _018_Module import func2
import _018_Module
_018_Module.func1()
func2()
_018_Module.func3()
output£º
This is function 1.
This is function 2.
This is function 3.
Àý3£º
# _018
# This is a module (if write Chinese in a module, there will be a error)
def func1():
print 'This is function 1.'
def func2():
print 'This is function 2.'
def func3():
print 'This is function 3.'
# 021
# ʹÓÓfrom ... import *”Óï¾äµ÷ÓÃÄ£¿é
from _018_Module import *
func1()
func2()
func3()
output£º
This is function 1.
This is function 2.
This is function 3.
Ïà¹ØÎĵµ£º
from: http://www.chinesepython.org/pythonfoundry/tut2.3/tmp/multiple.html
9.5.1 ¶à¼Ì³Ð Multiple Inheritance
Python supports a limited form of multiple inheritance as well. A class definition with multiple base classes looks as follows:
PythonͬÑùÓÐÏÞµÄÖ§³Ö¶à¼Ì³ÐÐÎʽ¡£¶à¼Ì³ÐµÄÀඨÒåÐÎÈçÏÂÀ ......
pythonʹÓÃSocketServers
SocketServersÄ£¿éΪһ×ésocket·þÎñÀඨÒåÁËÒ»¸ö»ùÀ࣬Õâ×éÀàѹËõºÍÒþ²ØÁ˼àÌý¡¢½ÓÊܺʹ¦Àí½øÈëµÄsocketÁ¬½ÓµÄϸ½Ú¡£
1¡¢SocketServers¼Ò×å
TCPServerºÍUDPServer¶¼ÊÇSocketServerµÄ×ÓÀ࣬ËüÃÇ·Ö±ð´¦ÀíTCPºÍUDPÐÅÏ¢¡£
×¢Ò⣺SocketServerÒ²ÌṩUnixStreamServer(TCPServerµÄ×ÓÀà)ºÍUNIXdatag ......
PythonÖеÄeasy_install¹¤¾ßºÜºÃÓã¬ËüµÄ×÷ÓÃÀàËÆÓÚPhpÖеÄpear£¬»òÕßRubyÖеÄgem£¬»òÕßPerlÖеÄcpan¡£
Èç¹ûÏëʹÓÃeasy_install¹¤¾ß£¬¿ÉÒÔÖ±½Ó°²×°ez_setup.py
½Å±¾£¬ÔÙpython ez_setup.py£¨Ö®Ç°ÏÈÒª°²×°python£©£º
°²×°Íêºó£¬×îºÃÈ·±£easy_installËùÔÚĿ¼ÒѾ±»¼Óµ½PATH»·¾³±äÁ¿Àï:
Windows: C:\Python25\Scripts
Li ......
¹ØÓÚC++ºÍPythonÖ®¼ä»¥Ïàµ÷ÓõÄÎÊÌ⣬¿ÉÒÔ²éÕÒµ½ºÜ¶à×ÊÁÏ¡£±¾ÎĽ«Ö÷Òª´Ó½â¾öʵ¼ÊÎÊÌâµÄ½Ç¶È¿´ÈçºÎ¹¹½¨Ò»¸öPythonºÍC++»ìºÏϵͳ¡£
&nbs ......
¶þÔªÔËËã·û¼°Æä¶ÔÓ¦µÄÌØÊâ·½·¨
¶þÔªÔËËã·û
ÌØÊâ·½·¨
+
__add__,__radd__
-
__sub__,__rsub__
*
__mul__,__rmul__
/
__div__,__rdiv__,__truediv__,__rtruediv__
//
__floordiv__,__rfloordiv__
%
__mod__,__rmod__
**
__pow__,__rpow__
<<
__lshift__,__rlshift__
>>
_ ......