首页 > 编程语言 > 详细

python 0007

时间:2018-10-24 21:06:20      阅读:146      评论:0      收藏:0      [点我收藏+]
#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())


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

python 0007

原文:https://www.cnblogs.com/bianzhuo/p/9846019.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!