pythonchallenge.com第三题

阅读更多
pythonchallenge.com第二题

#!/usr/bin/env python

def countchar(filename,count):
    fp = open(filename,'r')
    listcount = [0]*256
    tmp = fp.read(1)
    str = ''
    while tmp:
        listcount[ord(tmp)] = listcount[ord(tmp)] + 1
        tmp = fp.read(1)
    fp.close()
   
    for i in range(count):
        temp=0
        for x in range(len(listcount)):
            if listcount[x]>0:
                temp = x
                break
        print temp
        for p in range(len(listcount)):
            if listcount[p]0 :
                temp = p
        str += chr(temp)
        print str,temp
        listcount[temp] = 0
   
if __name__ == '__main__':
    url = raw_input('file url:  \n')
    count = raw_input('count:  \n')
    countchar(url,int(count))


recognize the characters. maybe they are in the book,
but MAYBE they are in the page source.
page source 开始还真的以为是图片里的文字呢,后来一想可能是网页源代码的意思,结果果然如此

结果得排序 equality

你可能感兴趣的:(python,pythonchallenge)