Renan Moura

Renan Moura

I'm a Software Engineer working in the industry for a decade now. I like to solve problems with as little code as possible. I’m interested in solving all sorts of problems with technology in creative and innovative ways. From everyday shell scripts to machine learning models. I write about Software Development, Machine Learning, and Career in tech.

isidentifier(): checking a valid identifier in Python

how to python

Use the isidentifier() method to check a valid identifier. A valid identifier has only letters, digits, and underscores. text = 'file1' print(text.isidentifier()) #output: True text = '1file' print(text.isidentifier()) #output: False text = 'file1_final' print(text.isidentifier()) #output: True text = 'file1 final'…

ljust(): left-justified string in Python

how to python

Use the ljust() to left-justify a string. word = 'beach' number_spaces = 32 word_justified = word.ljust(number_spaces) print(word) #'beach' print(word_justified) #'beach ' Notice the spaces in the second string. The word ‘beach’ has 5 characters, which gives us 27 spaces to…

rjust(): right-justified string in Python

how to python

Use the rjust() to right-justify a string. word = 'beach' number_spaces = 32 word_justified = word.rjust(number_spaces) print(word) #'beach' print(word_justified) #' beach' Notice the spaces in the second string. The word ‘beach’ has 5 characters, which gives us 27 spaces to…

Organizing Files in Python

how to python

This article covers operations you can do with a file regarding the Operating System: rename and move a file, check if a file exists, delete a file, make a copy of a file. This a direct extension of a previous…

While Loops in Python

how to python

Loops are used when you need to repeat a block of code a certain number of times or apply the same logic over each item in a collection. There are two types of loops: for and while. In this article,…