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

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¾Í¿ÉÒÔÁË¡£

ÒýÓÃ
¼ÈÈ»ÕâÑù£¬ºÎ±Ø·ÇÒªÓÃÕýÔò¡£ÓÃ# 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ºËÐıà³Ì¡·

×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg

ÒýÓÃ
×÷Î ......

python ÕýÔòÆ¥ÅäÖÐÎÄ

ÔÚÎı¾ÎļþÖÐÆ¥ÅäÏî°üº¬ÖÐÎÄ
ÈçÄÚÈÝΪ£ºgamename=ÖÐÎÄ 
  key=ÌìÏÂ
Îı¾ÎļþµÄ±àÂëµÄÎļþΪutf-8
python´úÂëÈçÏ£º
# -*- coding:UTF-8 -*-
  contents=open(from_pa ......

Çó¾ÈÇó¾ÈÇó¾ÈÒ»¶Îpython´úÂëµÄ×¢ÊÍ,¼±!

ÓÉÓÚÊǵÚÒ»´Î½Ó´¥python,Óï·¨Ò²²»¶®
µ«ÊÇÁÙʱҪÓõ½...

Çë°ïæעÊÍÒ»¶Î´úÂë...²»ÐèҪÿһ¾ä¶¼×¢ÊÍ,ÒòΪÊÇѧjavaµÄ,ËùÒÔ»ù±¾Ë¼Â·»¹ÊÇÓÐÒ»µã


#************************************************ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ