import xml.etree.ElementTree as ET
tree = ET.parse('otazkyzakony.xml')
root = tree.getroot()
i=1
for j in range(1,526):
	for otazka in root.findall('otazka'+str(i)):
		ot = otazka.get('ot'+str(i))
		print(str(j)+": "+ot+"\n")
		f = open("otza/za_"+str(j)+".txt", 'w')
		f.write(ot+"\n")
	for odpoved in root.findall('odpoved'+str(i)):
		od = odpoved.get('od'+str(i))
		print(str(j)+": "+od+"\n")
		f2 = open("otza/zao_"+str(i)+".txt", 'w')
		f2.write(od+"\n")
	i+=1
