python 0007

#coding='utf-8'#
import re
import os
def get_list():
    list_file=[]
    for f in os.listdir():
        if f.endswith('.py'):
            list_file.append(f)
        else :
            pass
    return  list_file

def get_read():
    dict={}
    count=0
    for x in get_list():
        f=open(x,'rb')
        for line in f.readlines():
            line=line.decode('utf-8').strip('\n')
            count+=1
            print(line)

    return  count

print(get_read())


字符编码问题有些晕圈,等我的笔记本修好了再看看视频吧,加油,少年郎。

posted @ 2018-10-24 20:39  大眼侠  阅读(167)  评论(0编辑  收藏  举报