python Æ¥ÅäurlÕýÔò±í´ïʽ
ÎÒÏÖÔÚÓÐÒ»¸öÕâÑùµÄ×Ö·û´®str1="http://hi.baidu.com/rubylang/blog/item/1661ad50d600c46784352445.html#/html/body/table[1]/tr/td"
Ôõôдһ¸ö±í´ïʽÀ´Æ¥ÅäËü£¬ÐèÒªpythonÓïÑÔ£¬²¢ÇÒÄܹ»°Ñ
http://hi.baidu.com/rubylang/blog/item/1661ad50d600c46784352445.html£¬¸ú/html/body/table[1]/tr/tdÌáÈ¡³öÀ´£¬
·Åµ½Á½¸ö±äÁ¿ÀurlµØÖ·²»Ò»¶¨¾ÍÉÏÃæÄǸö£¬¿ÉÒÔÊÇÆäËûµÄurlµØÖ·£¬ºóÃæµÄÒ²²»Ò»¶¨Ö»ÊÇÒ»¸ötable£¬»òÕßÒ»¸öҲûÓУ¬
Ò²¿ÉÄÜÓкܶà¸ö
¾ÍÊÇҪƥÅä
str2="urlµØÖ·#/html/.../.../"ÕâÑùµÄÇé¿ö£¬Âé·³¸÷λ´óÏÀ°ï棬¼±Óã¬thx
¼ÈÈ»ÕâÑù£¬ºÎ±Ø·ÇÒªÓÃÕýÔò¡£ÓÃ# split¾Í¿ÉÒÔÁË¡£
ÒòΪÎÒÒªÏÈÅжÏ×Ö·û´® ÀïÃæÊDz»ÊÇÓÐurlµØÖ·£¬Èç¹ûûÓеĻ°¾Í²»ÐèÒªÉÏÃæµÄ×ö·¨ÁË£¬ÓеĻ°²ÅÐèÒª°´ÕÕÉÏÃæµÄÀ´×ö£¬ÒòΪ¸Õѧ£¬ÎÒÒ²²»Çå³þsplitÔõôÓã¬Âé·³Ïêϸ½âÊÍһϣ¬×îºÃÓдúÂ룬thx
Python code:
str = "http://hi.baidu.com/rubylang/blog/item/1661ad50d600c46784352445.html#/html/body/table[1]/tr/td"
m = str.split('#')
print m
²»ÖªÊDz»ÊÇÄãÏëÒªµÄ¡£
or
>>> from urlparse import urlsplit
>>> s='http://hi.baidu.com/rubylang/blog/item/1661ad50d600c46784352445.html#/html/body/table[1]/tr/td'
>>> urlsplit(s)
SplitResult(scheme='http', netloc='hi.baidu
Ïà¹ØÎÊ´ð£º
ËÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
·¢ÏÖpython2.6
import httplib
conn=httplib.HTTPSConnection('x.x.x.x')
conn.request('','')
rd=conn.getresponse()
conn.close()
ÕâÑù½áÊøºó»á±ä³ÉCLOSE_WAIT״̬£¬ÎÒ ......