As I commented on the accepted answer using numpy , this can be done using a simple single line interface:
Assuming numpy imported as np (which is common practice),
np.savetxt('xy.txt', np.array([x, y]).T, fmt="%.3f", header="xy")
saves the data in a (optional) format and
x, y = np.loadtxt('xy.txt', unpack=True)
download it.
The xy.txt file will look like this:
# xy 1.000 1.000 1.500 2.250 2.000 4.000 2.500 6.250 3.000 9.000
Please note that the fmt=... format string is optional, but if the goal is human readable, it can be very useful. If used, it is set using regular printf codes (in my example: a floating-point number with 3 decimal places).
Dalker
source share