📌  相关文章
📜  python读取文本文件并以用户友好的方式显示项目 - Python代码示例

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

代码示例1
def extract_data(filename):
    infile = open(filename, 'r')
    infile.readline()  # skip the first line
    data = [line.split() for line in infile]
    annual_avg = data[-1][1]
    data = [(m, float(r)) for m, r in data[:-1]]
    infile.close()
    return data, annual_avg