Logo

Programming-Idioms

History of Idiom 104 > diff from v9 to v10

Edit summary for version 10 by Fazel94:
New Python implementation by user [Fazel94]

Version 9

2017-07-29, 10:55:43

Version 10

2019-09-27, 14:19:13

Idiom #104 Save object into XML file

Write content of object x into file data.xml.

Idiom #104 Save object into XML file

Write content of object x into file data.xml.

Imports
import pyxser as pyx
Code
# Python 2.5 to 2.7
# Use pickle or marshall module
class TestClass(object):
    a = None
    b = None
    c = None

    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c

tst = TestClass("var_a", "var_b", "var_c")
ser = pyx.serialize(obj=tst, enc="utf-8")
print(ser)
Doc URL
http://coder.cl/products/pyxser/
Origin
https://github.com/dmw/pyxser