Skip main navigation

Hands-on: Input and output

Explore NumPy's in-built file I/O
© CSC - IT Center for Science Ltd.

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

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now