Skip to content

Tag: python

Get .wav file length or duration

I’m looking for a way to find out the duration of a audio file (.wav) in python. So far i had a look at python wave library, mutagen, pymedia, pymad i was not able to get the duration of the wav file. Pymad gave me the duration but its not consistent. Answer The duration is equal to the number of

Is there a way to get a list of column names in sqlite?

I want to get a list of column names from a table in a database. Using pragma I get a list of tuples with a lot of unneeded information. Is there a way to get only the column names? So I might end up with something like this: [Column1, Column2, Column3, Column4] The reason why I absolutely need this list

How to properly escape single and double quotes

I have a lxml etree HTMLParser object that I’m trying to build xpaths with to assert xpaths, attributes of the xpath and text of that tag. I ran into a problem when the text of the tag has either single-quotes(‘) or double-quotes(“) and I’ve exhausted all my options. Here’s a sam…

How do you install or activate PyUno in LibreOffice?

How do you make Python (any Python) know about PyUno in LibreOffice? When I do: python says that it knows no module “uno”. (This question came up re. this question.) Answer Here’s what I did: inside the LibreOffice directory, there is a “program” directory with a python.exe, if I…

When do you use ‘self’ in Python? [duplicate]

This question already has answers here: What is the purpose of the `self` parameter? Why is it needed? (26 answers) Closed 6 months ago. Are you supposed to use self when referencing a member function in Python (within the same module)? More generally, I was wondering when it is required to use self, not just…