B

\"@s<ddZddZddZddZdd	Zd
dZdd
ZdS)cCsd}|d}|d|d7}xX|D]P}x,|D] \}}d|kr6d|d||<q6W|}|d|7}|d7}q(W|S)Nz, 
,")keysjoinitemsvalues)	list_dictcsv	col_namesdictcol_name	col_value
col_valuesr3/home/s/sultans/web/python/demo/etl/util/convert.pyobj2csv
s
rcCsddl}|j|dd}|S)Nr)indent)jsondumps)r
rrrrobj2json src
Cstd}d}|d7}xV|D]N}|d7}x8|D],\}}|d7}|d|d|d|d	7}q,W|d
7}qW|d7}|S)Nrz<?xml version='1.0'?>
z<root> 
z    <row> 
z        <>z</z> 
z    </row> 
z	</root> 
)r)r
xmlr
namevaluerrrobj2xml-s
 rc
Cspddl}d}d}g}td}|j||||jdd}x8|D]0}i}x|D]\}}	|	||<qJW||q8W|S)Nrrrz./home/s/sultans/web/python/demo/etl/output.txtT)	delimiterZ	quotecharZquotingZskipinitialspace)ropenZ
DictReaderZ	QUOTE_ALLrappend)
rdelimquoter
filenameZlist_list_tupleZ
list_tupler
rrrrrcsv2objHs
r%cCsddl}|d}g}i}|d|d}xtdt|dD]}d}d}xF||D]:}	|	dksh|	dkrv|rrd}nd	}|	d
kr|rd}	||	7}qTW|d|}
d}xN|
D]F}|dd
|}|dd|}|dd|}||}
|||
<|d7}qW||i}q>W|S)Nrrz\s*,\s*rFr'Tr~)resplitrangelensubr!)rr)linesr
r
ridxZ
col_stringreplacecharrirrrrrcsv2obj_custombs8


r3cCsddl}||}|S)Nr)rloads)datarr
rrrjson2objs
r6c	Cslddl}|d}g}i}xL|D]D}|d|}|rR|d}|d}|||<q |r ||i}q W|S)Nrrz<(.+?)>(.*?)</.+?>r&)r)r*searchgroupr!)	rr)r.r
r
linefoundrrrrrxml2objs





r<N)rrrr%r3r6r<rrrr<module>
s
'