The Variable Explorer allows you to browse and manage the objects generated by running your code interactively.
Continue readingCategory Archives: Python
Remove Seconds From Datetime in Python
This article focuses on how to remove seconds on Python datetime objects. The seconds can be removed in two ways – simply truncating seconds by turning them to 0 or by rounding off seconds into minutes.
Continue readingConvert Image Into Byte Array in Python
Python’s built-in bytearray function allows us to convert arrays to byte arrays. Because an image is just an array of numbers, we will leverage this method to convert images into a byte array.
Continue readingExpected an Indented Block Error in Python
A Quick Answer
This error occurs when Python expects an indented block and doesn’t find it. For example:
Continue readingNo Module Named Venv in Python 3
The venv module comes pre-installed in Python 3.3 and later. If the module is not installed, then you will run into ModuleNotFoundError: No module named ‘venv’ when you try importing the module on the script (by running “import venv“) or on the terminal/command line when you run “python -m venv <env_name>“.
Continue readingRead a CSV File From a Url in Python
Python provides capabilities to read CSV data directly from the web. This post will show how to load CSV in three ways-: using pandas, urllib, and requests packages in python.
Continue readingOpen URL in Chrome Browser in Python
The webbrowser module, which comes preinstalled with Python, is a library that can be used to control web browsers. This article will show how this module can be used to open tabs and windows on installed browsers. You will get to choose the browser to use, whether to open the URL you want to visit on a new window or not and whether to open a new tab.
Continue readingCount Lines of Code in a Directory using Python
This article discusses how to count lines in all the files in all the folders inside the root directory of our interest. Here is a look at the directory structure we will use to test our code.
Continue readingPython CSV Reader Encoding
Pandas and csv libraries are popular names when handling CSV files. Python comes pre-installed with csv, but for pandas, you must install it before using it.
Continue readingHow to Uninstall Python
Preliminary (Important)
- (Caution Note) Linux – It might not be safe to uninstall Python. Follow the instructions keenly.
- Windows – It is safe to uninstall Python completely, provided it is done correctly.