Skip to content

Tag: python-3.x

Extracting XML Attributes

I have an XML file with several thousand records in it in the form of: How can I convert this into a CSV or tab-delimited file? I know I can hard-code it in Python using re.compile() statements, but there has to be something easier, and more portable among diff XML file layouts. I’ve found a couple thre…

Overriding in Python

I want to be able to do the following I would like to get a parent function from a child class in a function that is overriding it. I am not sure how to do this. This is a little hard to explain, comment if you are having trouble understanding. Edit: Thanks for the answers everyone, I almost thought that

Generate list of numbers in specific format

I need to generate a list of numbers in a specific format. The format is I know how to generate a normal list of numbers using range So, is there any built-in way in python to generate a list of numbers in the specified format. Answer Python string formatting allows you to specify a precision: Precision (opti…

Validate Postal Code?

I’m doing some tutorials online…and I’m stuck at an exercise:Define a function postalValidate(S) which first checks if S represents a postal code which is valid. Note: I’m supposed to solve it with strings, lists, if statements, loops, and other basic constructs like variables and func…