📌  相关文章
📜  如何在 python 代码示例中从文本文件中读取数字

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

代码示例1
with open('file') as f:
    w, h = [int(x) for x in next(f).split()] # read first line
    array = []
    for line in f: # read rest of lines
        array.append([int(x) for x in line.split()])