Fix Python – Python, remove all non-alphabet chars from string

I am writing a python MapReduce word count program. Problem is that there are many non-alphabet chars strewn about in the data, I have found this post Stripping everything but alphanumeric chars from a string in Python which shows a nice solution using regex, but I am not sure how to implement it
def mapfn(k, v):
print v
import re, string ….

Fix Python – How can I make a scatter plot colored by density in matplotlib?

I’d like to make a scatter plot where each point is colored by the spatial density of nearby points.
I’ve come across a very similar question, which shows an example of this using R:
R Scatter Plot: symbol color represents number of overlapping points
What’s the best way to accomplish something similar in python using matplotlib?

Fix Python – How do you send a HEAD HTTP request in Python 2?

What I’m trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download the content. Does anyone know o….

Fix Python – How to properly use the “choices” field option in Django

I’m reading the tutorial here:
and i’m trying to create a box where the user can select the month he was born in. What I tried was
(JANUARY, “January”),
(FEBRUARY, “February”),
(MARCH, “March”),
(DECEMBER, “December”),

month = CharField(….

Fix Python – What is this odd colon behavior doing?

I am using Python 3.6.1, and I have come across something very strange. I had a simple dictionary assignment typo that took me a long time to find.
context = {}
context[“a”]: 2


What is the code context[“a”]: 2 doing? It doesn’t raise a SyntaxError when it should IMO. At first I thought it was creating a slice. However, t….

Fix Python – What’s the difference between ContentType and MimeType?

As far as I know, they are absolute equal. However, browsing some django docs, I’ve
found this piece of code:
HttpResponse.__init__(content=”, mimetype=None, status=200, content_type=’text/html’)
which surprise me the two getting along each other. The official docs was able to solve the issue in a practical manner:

content_type is an alias for m….