back soft

مطالب مرتبط با «how to optimize code in c» در back soft | نویسنده: استخدام کار

Python, multiprocessing: How to optimize the code? Make the code faster?

Vote count: 0 I use Python. I have 100 zip files. Each zipfile contains more than 100 xmlfiles. Using the xmlfiles I create csvfiles. from xml.etree.ElementTree import fromstring import zipfile from multiprocessing import Process def parse_xml_for_csv1(data, writer1): root = fromstring(data) for node in root.iter('name'): writer1.writerow(node.get('value')) def create_csv1(): with open('output1.csv', 'w') as f1: writer1 = csv.writer(f1) for i in range(1, 100): z = zipfile.ZipFile('xml' + str(i) + '.zip') # z.namelist() contains more than 100 xml files for finfo in z.namelist(): data = z.read(finfo) parse_xml_for_csv1(data, writer1) def create_csv2(): with open('output2.csv', 'w') as f2: writ...

ادامه مطلب