 |
Writing and reading an object using its title as a key (PFile class)
Source code name: "io_pfile2.py"
Programming language: Python
Topic: File IO/Binary
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/io_pfile2_6932.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.
# S.Chekanov
from jhplot.io import *
from jhplot import *
from java.util import Random
c1 = HPlot3D("Canvas",600,400,2,1)
c1.setGTitle("I/O test")
c1.visible(1)
c1.setAutoRange()
h1 = H2D("input2D",5,-2, 2.0, 5, -3,3)
r = Random(33)
for i in range(100):
h1.fill(r.nextGaussian(), r.nextGaussian())
c1.draw(h1)
f=PFile('tmp.pbu','w')
f.write(h1)
f.write(P0D("sss"))
f.close()
c1.cd(2,1)
c1.setAutoRange()
f=PFile('tmp.pbu','r')
print f.size()
print f.listEntries()
c1.draw( f.read("input2D") )
f.close()
You see the box below because you did not login.