Answers for "how to read numbers from a text file in python"

0

how to read numbers from a text file in python

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()])
Posted by: Guest on January-16-2022

Code answers related to "how to read numbers from a text file in python"

Python Answers by Framework

Browse Popular Code Answers by Language