Logo

Programming-Idioms

History of Idiom 104 > diff from v13 to v14

Edit summary for version 14 by 111:
Admin deletes impl 3264: Python 2 is deprecated, see issues/184

Version 13

2021-12-01, 01:02:04

Version 14

2021-12-23, 09:17:16

Idiom #104 Save object into XML file

Write the contents of the object x into the file data.xml.

Idiom #104 Save object into XML file

Write the contents of the object x into the file data.xml.

Variables
x,data,xml
Variables
x,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