Operating System

How To Execute System Commands With Python?

In this article, we will learn numerous ways to execute system commands in Python. ➥ Problem: Given an external command that can run on your operating system, how to call the command using a Python script? ➥ Example: Say you want to ping a remote server using your operating system’s ping command—all from within your Python program. How …

How To Execute System Commands With Python? Read More »

How to Open Python .py Files in IDLE with a Doubleclick?

I love tweaking my coding workflow. Small improvements accumulate over time and can lead to a massive productivity increase. Today, I caught myself being annoyed that I always needed to spend three clicks or so just to open a Python file in IDLE, the default Python editor on Windows. Time to change that! Do you …

How to Open Python .py Files in IDLE with a Doubleclick? Read More »

How to Find Path Where Python is Installed on Windows?

Windows normally installs Python on one of the two locations: C:\Python39 C:\Users\YourUser\AppData\Local\Programs\Python\Python39 For me, it’s the latter. For you, it may be different—this article shows you how to check for yourself! 🙂 For your convenience, I’ve made a short gif that shows how I rushed through the code on my Windows machine: Before you start, …

How to Find Path Where Python is Installed on Windows? Read More »

How to Append Data to a JSON File in Python? [+Video]

Problem Formulation Given a JSON object stored in a file named “your_file.json” such as a list of dictionaries. How to append data such as a new dictionary to it? # File “your_file.json” (BEFORE) [{“alice”: 24, “bob”: 27}] # New entry: {“carl”: 33} # File “your_file.json” (AFTER) [{“alice”: 24, “bob”: 27}, {“carl”: 33}] Method 1: Using …

How to Append Data to a JSON File in Python? [+Video] Read More »

Creating, Reading & Updating A Config File with Python

Subtitle: Avoid Hard-Coded Data While Making Your (And Others) Life Easier When the subject of config, or configuration, files comes up there is often confusion on what they are, how to read them, and the benefits that come from their use. In this article, we will cover what config files are before introducing the Python …

Creating, Reading & Updating A Config File with Python Read More »