Skip main navigation

Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. T&Cs apply

Hands-on: Input and output

Explore NumPy's in-built file I/O
In this exercise we study how to read and write arrays to disk.

Source code for this exercise is located in numpy/input-output/

File numpy/input-output/xy-coordinates.dat contains a list of (x,y) value
pairs. Read the data with numpy.loadtxt(). Add then 2.5 to all y values and
write the new data into a file using numpy.savetxt().

© CSC - IT Center for Science Ltd.
This article is from the free online

Python in High Performance Computing

Created by
FutureLearn - Learning For Life