-
Notifications
You must be signed in to change notification settings - Fork 4
/
TallPy.py
66 lines (52 loc) · 1.57 KB
/
TallPy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from xml.etree import ElementTree as ET
import sys
##Validation if no intergers are inputed
'''def A():
while True:
A.x = input('Enter party name: ')
if A.x.isdigit() == True:
print('Please enter a name.')
continue
else:
return A.x
break
'''
def A(party_name):
A.x = party_name
return A.x
'''def initialize_x(value)
x = value
'''
#Initialization of ElementTree and Finding the list/numbers of each Tag
def B():
tree = ET.parse('Bills.xml')
root = tree.getroot()
B.billfixed = tree.findall('BILLFIXED')
B.billcl = tree.findall('BILLCL')
B.billdue = tree.findall('BILLDUE')
B.billoverdue = tree.findall('BILLOVERDUE')
def C():
y= A.x
b = []
#Itering and zipping the orphaned children
for fixed, cl, due, overdue in zip(B.billfixed, B.billcl, B.billdue, B.billoverdue):
#Getting it all lower case and then comparing
if y.lower() == fixed.find('BILLPARTY').text.lower():
date = fixed.find('BILLDATE').text
ref= fixed.find('BILLREF').text
party = fixed.find('BILLPARTY').text
b = ' * [Inv # {}] [Date {}] [Amt {}] [Due date {}] [Overdue by {} days]'.format(
ref, date, cl.text, due.text, overdue.text
)
print('******************************************************************')
else:
print('Party name not found!')
sys.exit()
def main_loop(for_a):
A(for_a)
B()
C()
from_c =
return
if __name__ == '__main__':
main_loop()