blog

Notes on Regex

I’m going to use python. Regex can be used by using the re library. You should not refer to this post as these are just notes, it would be better to follow the actual documentation of the library. To use regex, which uses backslashes \ we must use raw python strings like r”\n”. . matches anything but a newline \d matches 0-9 while \D matches anything but digits. …

Notes on Regex Read More »

If you are using os rename src dest…

If you are using os.rename(src,dest) outside the current working directory, you can’t simply use os.rename(filename, “output.mp3”) since it will move the file to the current working directory. You should rather, path.dirname to get the file’s directory and then rename the file. For example you can use `os.rename(file_name, os.path.dirname(file_name) + ‘/{song_title}.mp3’.format(song_title=song_title))`

Scroll to Top