Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46850f7

Browse files
committed
getFieldNum
1 parent b6a2491 commit 46850f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyfile/file_read.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ def readFile(s):
44
line = f.readline()
55
while line:
66
print(line)
7+
getFieldNum(line)
78
line = f.readline()
89
f.close()
910

1011

12+
def getFieldNum(line):
13+
import re
14+
matches = re.finditer(r'\S+', line)
15+
# 打印 a 字符出现的次数
16+
print(matches)
17+
18+
1119
if __name__ == "__main__":
1220
readFile("/Users/xhzh/Desktop/etfbak8")

0 commit comments

Comments
 (0)