File output of a list
Code: "io_example2.py". Programming language: Python DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/io_example2_3366.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


from jhplot  import *

p1=P1D("test") # create 2D array and fill it
p1.add(10,20)
p1.add(12,40)
print p1.toString()

p2=P0D("test2")  # create 2D arrays and fill it
for i in range(10):
     p2.add(i*i)

a=[p1,p2]               # make a list
IO.write(a,'file.ser')  # write the list to the file
fas=IO.read('file.ser') # read the data from the file
 
p1=fas[0];  p2=fas[1]           # read 2D arryas from the list             
print "After serialization:n"
print p1.toString(); print p2.toString()

Ads help maintain this website.