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

¹ØÓÚpython¶ÁÁÐÊý¾Ý

a.txt
ÎļþÄÚÈÝÈçÏ£¨ÆäÖпհײ¿·Ö¶¼ÊÇÒÔtab¼ü¸ô¿ª£©£º

om 2 0.68 0.83 0 0 0 0 0 0
pos
ppa 17 0.74 0.9 0 0 0 1 2 2
ppc    2                     2 0.51 0.75 0 0 1

È»ºóÓÃÒÔÏ´úÂë²Ù×÷Õâ¸öÎı¾Îļþ
f = open("a.txt")
for aline in  f.readlines():
    //ʵÏÖ´úÂë
ÏÈÆ¥ÅäµÚÒ»ÁÐÃû³Æ£¬È»ºóʵÏÖ¶ÁÈ¡¸ÃÐеÚËÄÁеÄÊý¾Ý¡£Èç¹ûΪ¿ÕµÄÔò·µ»Ø0¡£ÒòΪ¿Õ°×²¿·Ö¶¼ÒÔtab¼ü¸ô¿ª£¬ËùÒÔ¿ÉÒÔÑϸñ¶ÁÈ¡µÚËÄÁС£

ÖصãÊÇ£ºÈçºÎÆ¥Åä+ÈçºÎ¶ÁÈ¡µÚËÄÁÐ


×Ô¼ºÊǸöÐÂÊÖ£¬ÊµÏÖ´úÂëÈçºÎд£¬
¶àл¸÷λ¡£
ÊÔ¹ýÓà os.open.(cmd).readlines()д£¬µ«ÊÇÎÒÃǵķþÎñÆ÷¶ÔshellÃüÁîûÓÐȨÏÞ²Ù×÷ËùÒÔÖ»ÄÜÓà ÕâÖÖ·½·¨¡£


eachlineList = aline.split()
if re.match('ppa',eachlineList[0]):#Æ¥ÅäµÚÒ»ÁÐ
    print eachlineList[4]££´òÓ¡µÚËÄÁÐ

20%µÄ½áÌùÂÊ

¶÷£¬ÎÒÊÇÐÂÈË¡£

try:
    print aline.split('\t').[3]
except:
    print 0

Thank you for luckygxboy &  yuanvshu.
The solution from luckygxboy is done.



Ïà¹ØÎÊ´ð£º

IIS 7 python 2.6 cgi ÎļþÉÏ´«ÎÊÌâ

ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......

³ÏÕÐPython³ÌÐòÔ±²ÎÓë¼ÆËã»úÊé¼®³ö°æ

ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£ 
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º 
1¡¢·áºñµÄ¸å³ê¡£ 
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£ 
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......

¶®pythonµÄjava¸ßÊÖÇë½Ì - Java / Java SE

ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......

Python±à³ÌÎÊÌ⣬¿ÒÇë¸ßÊÖ½â»ó

×î½üÃÔÉÏÁËPython£¬ÔÚ˼¿¼ÔõÑùÓÃPythonд¸ö³ÌÐòʵÏÖ¶ÔÖ¸¶¨ÍøÂç¶Ë¿ÚµÄÊý¾Ý°üµÄץȡºÍ½âÎö£¬¿ÒÇë¸ßÊÖÖ¸½Ì£¡£¡

ÄãºÃ£¡
Ê×ÏÈ£¬ÊµÏÖ²¶°üµÄ¹¦ÄÜÐèҪʹÓÃwincap£¨windowsÏ£©£¬»òÕßlibpcap£¨LinuxÏ£©¡£
¶øPythonÌṩÁ ......

python²é¿´class²ÎÊý

Àà:
class Test:
  def __init__(self,num1,num2):
  print num1,num2
ÓÃʲôº¯ÊýÄܲ鿴 TestÀàÓÐÁ½¸ö²ÎÊý
ÄܲéÂð Ë­ÖªµÀ
ÓÃdir ºÍinfoÖÇÄܲ鿴ÊôÐԺͷ½·¨

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