import linecache spa
#thefiepath 文件路徑 ci
#desired_line_number 整數,文件的特定行 get
theline = linecache.getline(thefilepath, desired_line_number)it
統計文件有一共有多少行console
count = len(open(thefilepath).readlines( )) import