Skip to content
Advertisement

What is the default content-type/charset?

According to this answer: urllib2 read to Unicode I have to get the content-type in order to change to Unicode. However, some websites don’t have a “charset”. For example, the [‘content-type’…

Creating thumbnails from video files with Python

I need to create thumbnails for a video file once I’ve uploaded to a webapp running python. How would I go about this… I need a library that can basically either do this for me, or that can read …

Understanding generators in Python

I am reading the Python cookbook at the moment and am currently looking at generators. I’m finding it hard to get my head round. As I come from a Java background, is there a Java equivalent? The book …

How do I concatenate two lists in Python?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. How do I concatenate two lists in Python? Example: Expected outcome: Answer Use the + operator to combine the lists: Output:

Check if object is file-like in Python

File-like objects are objects in Python that behave like a real file, e.g. have a read() and a write method(), but have a different implementation from file. It is realization of the Duck Typing …

Advertisement