AI & Python #34: Tools That Made My Life Easier When Writing Code
Tools that you need as a beginner programmer.
As a beginner, I used to come across some roadblocks that slowed down my workflow.
Sometimes I forgot the format needed to create a cron job, a metacharacter needed to build the right regular expression, etc. The tools listed in this article helped me easily deal with these issues.
Regex101: Test your regular expressions
Have you been in a situation where you need to match a specific search pattern but can’t build the regular expression (regex) that does the job?
You know regex but you just don’t remember that metacharacter that does the trick or something goes wrong when you build a long regular expression.
I used to have this issue … until I found Regex101.
Regex101 is a tool that we can use to test our regular expressions. You only need to type a regex and the text that matches will be highlighted in blue.
Say we want to identify valid emails with a regular expression.
As you can see in the gif above, only the first email is highlighted in blue because that’s the only valid email.
Crontab Guru
Every time we need to schedule a task on macOS and Linux we create a cron job. This allows us to automate a script to complete a task any time we wish.
The problem is that if we don’t create the right cron expressions, the job could never start or fail.
That’s why we need to use Crontab Guru.
Crontab Guru is a quick and simple editor for cron schedule expressions.
You only need to type the minute, hour, day, and month to see what that expression means in plain English and know when’s the next time the script is going to be executed.
Strftime
Datetime is a very useful module that allows us to work with dates and times in Python. To convert a date/time object to string we need to use the strftime()
method as shown below.
from
datetime import
datetime
now =
datetime.now()
now.strftime(<format>)
Simple, right? The thing is, I sometimes forget the format used to convert the date to their string representation.
Fortunately, there’s a website called strftime where you can find a Python strftime cheatsheet.
Now I can easily get today’s date in the format I want.
>>> now.strftime("%B %d, %Y")
'October 28, 2022'
HTML Editor
HTML Editor is a tool that allows us to create HTML documents as if we were typing text in a Word document.
Say we want to create an HTML document that has a title, paragraph, and list that looks like the one below.
Well, we can easily do that with HTML Editor.
On this website, we only need to type text in the visual editor on the left and it automatically generates its HTML code on the right.
Note that you can use the toolbar to add different elements to the document such as lists, lines, images, links, etc.
Although there are other alternatives, HTML editor is the best online software with visual preview, inline editor, and markup clean-up feature.