Categories
Uncategorized

Range of Dates – Python

This short script will help you create a range of dates that look like this 201203,201205,201306….

Categories
Uncategorized

Simple File Lists – python

How to make quick directory lists in python. All of these will use listdir in the os module. so we need to import it first Now we want to list all the files in a directory called my_folder. But the trick is that we only want the text files. Another thing we can do is […]

Categories
Uncategorized

Formatting Integers – Python

We have a range from 1 to 100 and we want to format the integers so that they look nice. Something like this so first we create the range which should result in something like this The actual formatting code is quite simple, this But to apply it to a list, we can do this […]

Categories
Uncategorized

Substituting words with lists and dictionaries – Python

So we have the following string Except that it does not paint a good picture of Brighton, and The Man doesn’t like it. There are two things that we can do. We can substitute all the negative words with the same item using a list, or we can swap the negative words with nicer ones […]