📜  python 数据结构 9.4 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:17.284000             🧑  作者: Mango

代码示例1
name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
count = 0
for i in handle:
    if i.startswith("From "):
        a = i.split()
        b = a[1]
        if b.startswith("cwen"):
            count+= 1
            if count == 5:
                print(b,count)