Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PythonΪÀඨÒå¡°¿½±´¹¹Ô캯Êý¡±

³õѧPython£¬Õâô×öºÃÏñÓеã2£¬´ÕºÏÄÜÓãº
class MyClass():
def __init__(self, n = 10):
self._Field = n
def __getitem__(self, range):
return MyClass(self._Field)
obj1 = MyClass()
obj2 = obj1
obj3 = obj1[:]
obj1._Field = 100
obj4 = MyClass(123)
print obj1._Field, obj2._Field, obj3._Field, obj4._Field 
ʵ¼ÊÊä³öΪ£º
>>> 100 100 10 123


Ïà¹ØÎĵµ£º

python »ñÈ¡±¾»úip

>>> from socket import socket, SOCK_DGRAM, AF_INET
>>> s = socket(AF_INET, SOCK_DGRAM)
>>> s.connect(('google.com', 0))
>>> s.getsockname()
('192.168.1.113', 43711) 
Linux:
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = ......

ÈçºÎÔÚApacheÏÂÉèÖÃPython(WIN,CGI·½·¨)

¹ØÓÚPython£¬±¾È˲»Ïë¶à˵ÁË£¬Èç¹û²»ÖªµÀʲôÊÇPython£¬¿ÉÒÔ¿´¡¶Ê²Ã´ÊÇPython
£¿¡·Ò»ÎÄ¡£Python¿ÉÒÔ¿ª·¢CGI³ÌÐò£¬ÄÇôÔÚApacheÏÂÓ¦ÈçºÎÅäÖÃÄØ£¿±¾ÎÄÖ»½²ÊöÁËÈçºÎ
ÒÔCGI·½Ê½ÅäÖÃApache£¬Ê¹ÆäÖ§³ÖPython³ÌÐò¡£ÆäËü·½Ê½£¬Èçmod_pythonÔò²»ÔÚÌÖÂÛ·¶Î§
(ÆäʵÊÇûÅä³É¹¦:-)¡£ÎÒËùʹÓõÄϵͳ»·¾³ÎªWindows 2000, Apache 1.3.19£ ......

pythonÖеÄlistÈçºÎ½øÐÐÏà¼õ²Ù×÷»òÕß½«list·ÖƬ


ÎÊÌâÃèÊö£º¼ÙÉèÎÒÓÐÕâÑùÁ½¸ölist£¬
          Ò»¸öÊÇlist1£¬list1 = [1, 2, 3, 4, 5]
          Ò»¸öÊÇlist2£¬list2 = [1, 4, 5]
          ÎÒÃÇÈçºÎµÃµ½Ò»¸öеÄlist£ ......

Python ÖÐÎÄ×Ö·û´®µÄ½ØÈ¡

def
subString
(s,
length):
   
us = unicode(s, 'utf-8
')
    gs =
us.encode('gb2312
')
    n = int(length)
   
t = gs[:n]
    while True
:
        try
:
  &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ