1. 程式人生 > >python3讀取指定欄位,並批量讀入

python3讀取指定欄位,並批量讀入

 

#shell指令,批量傳入
cat titleTest*.txt | python3 readFileTest2.py

 

#讀取傳入檔案指定欄位
#auto=wangshiyu
#File=readFileTest2.py

import sys

for line in sys.stdin:
	start=line.find('<title')
	end = line.find(('>'),len('>')+start)
	print( line[start+7:end])