Tag: python

Total 29 Posts

Append vs Extend in Python Lists

Adding Elements to a List

Lists are one of the most useful data structures available in Python, or really any programming language, since they're used in so many different algorithms and solutions.

Once we have created a list, often times we may need to add new elements to it, whether

Continue Reading

Python Circular Imports

What is a Circular Dependency?

A circular dependency occurs when two or more modules depend on each other. This is due to the fact that each module is defined in terms of the other (See Figure 1).

For example:

functionA():  
    functionB()

And

functionB():  
    functionA()

The code above depicts a fairly

Continue Reading

Python: List Files in a Directory

I prefer to work with Python because it is a very flexible programming language, and allows me to interact with the operating system easily. This also includes file system functions. To simply list files in a directory the modules os, subprocess, fnmatch, and pathlib come into play. The following solutions

Continue Reading