What a World We Live In

Just in some spare time, because one of my less technical friends was wondering, I wrote a neat little script to parse wikipedia to find out which months had the most serial killers born in them and the results are in.

Interestingly, or not, I wouldn’t say there was any strong trend, but some months definitely had and advantage over others. But given that out of the 1380 or so serial killers listed, only 65% of them had any date of birth data, and even then, only 40% of the total had their full date of birth listed (that the script would pick up that is), so it’s not like we’re working with the full data set. Although one interesting thing that could actually be pulled from the data was that almost 60% of the listed serial killers were from the United States (regardless of whether their birth date was listed).

The script pretty much just had urllib request the serial killer list, which beautifulsoup would then parse the links out of, which would then be followed. On each serial killers page (if one existed) there would be an attribute with the class “bday” (cute right?), although only 65% had this attribute. From the ones that did, the data of this attribute was grabbed, which was in the form yyyy-mm-dd, which was then split to grab the month, and counted. But only 40% had a date that could be split, such as if they only had a year instead of the full date.

One interesting thing I got to put to use was pythons else statement after loops, which seemed a bit random when I first stumbled onto them. But they only execute when the loop exits cleanly (with no break), which doesn’t seem to have too many use cases. But I found one, when nesting loops, since python doesn’t have a way to break out of an outer loop from an inner loop, you can use an else after the inner loop, with a continue, and a break after the whole inner loop structure. This makes it so that if the inner loop doesn’t break the continue will be hit, but if it does the else won’t trigger and the break will hit instead of the continue, breaking the outer loop as well.

Leave a comment