0

Here is the basic code. I want to pass on printing if the value is not an int. I am a nube so go easy please. Also, I am sure my code is garbage so if you can also help with that i would be grateful.

with open(file) as file:
for Properties in root.iter('Properties'):
    Name = Properties.get('Name')
    Value = int(Properties.get('Value'))
    if int(Value) > 1:
        print(Name, "( ""LICENSE COUNT =", Value, ")")
    else:
        pass
    file.close()
    file.closed
  • In what number system would `201806-111-01471` be a valid integer? The only way for it to be an integer is to evaluate it as a math operation (201806 minus 111 minus 1471 equals 200224), but a cast does not do mathematical evaluatioins. You can't cast noise to an `int` and expect to get anything meaningful. – Ken White Apr 21 '20 at 02:42
  • I can see this but I am not sure how yet to avoid passing it at all. I would love to skip it while parsing but cannot figure out how to. P.S also, how could you hear all that noise in my own head? haha – Brian Abbondanza Apr 21 '20 at 03:21
  • I found a new way to approach this. Probably still not ideal. Changed to str() and then checked against is.decimal. This removed the error and gave me the results i was looking for. – Brian Abbondanza Apr 22 '20 at 17:11

0 Answers0