Geek Logbook

Tech sea log book

 Escape sequences in Pyhon

Escape sequences as in C While reading Automate the Boring Stuff with Python: Practical Programming for Total Beginners, I noticed the existence of raw strings. A raw string is created in such a way that escape sequences listed in the Python documentation are not processed. In fact, at the beginning of the section on Lexical

Dictionary methods: keys(), values(), and items()

In Python, there are three special methods related to dictionaries that are worth mentioning: keys(), values(), and items(). Interestingly, these methods do not return true lists. They cannot be modified and do not have an append() method. However, dict_keys, dict_values, and dict_items can be used in for loops. This distinction is important to keep in

Sellenium Vs Beautiful Soup

Web scraping is a widely recognized strategy for acquiring information. Before diving into this process, it’s crucial to familiarize oneself with two essential tools. Personally, this topic initially posed a significant challenge for me when attempting to extract data from the web. These tools serve distinct purposes in web scraping and automation. Selenium is primarily

Logging in a file to avoid print statements

A video that was enlightening We need to avoid the misuse of the print statements once we master the basic tools and ideas about programming in particular and software developer in general. So, here there are some notes about loggers. Loggers have five levels, by critically: By default we typically set info and above. This

Python calculate seconds and total_seconds

If you want to calculate the total seconds between two dates. You could be tempted to do a time delta and see the seconds. But this approach will give you an unexpected result. You have to use time_second. Return the total number of seconds contained in the duration.  https://docs.python.org/3/library/datetime.html#datetime.timedelta.total_seconds Source:

Logger In python – First Approach

Besides using the print statements and the debugging tools sometimes (more and more frequently) I’m seeing in the code the logging module. According to the python documentation: This module defines functions and classes which implement a flexible event logging system for applications and libraries. The key benefit of having the logging API provided by a

Enviroments in Virtual Env

The importance of using environments As was said in Setting environments in Python it’s important to use environments for your deployment, even if these are side projects or wild repositories. But at first, I used Conda to create the environment. However, a while ago, I made the switch to Virtual Env As a point of

Testing in Python: Pytest Vs Unit test

How important are the tests? Testing is one of the most important skills we need to develop once we join the industry. In fact, knowing about testing is something that is not as evaluated as it could be. In general, the challenges are related to having logic related to programming skills or knowing about design