import linecache #thefiepath 文件路徑 #desired_line_number 整數,文件的特定行 theline = linecache.getline(thefilepath, desired_line_number)