python RSS
Follow The Programmer Blog RSS feed to stay up to date with the latest programming tutorials regarding anything python. If you're looking to upgrade your software developer shirt collection we offer some pretty cool programmer shirts. For more of the latest developer news and programming tutorials visit The Programmer Blog. View all programming tutorials tagged with python below:Python - For Loop
The Python for loop is used to iterate a sequence. The for keyword acts very similarly to that of C++ and Java. Let's have a look at some for loop examples below. For loop flowchart Before we dive into code examples, let's take a quick look at the flowchart below. First we execute the body and then we check a condition. If it's true we...
Python - Reading a file line-by-line into a list
A common question asked when programming with Python is How do I read every line of a file in Python and store each line as an element in a list? Below we will go over an example to show you how to read the file and append each line to the end of a list. Reading a small file into a...
Python - Call an External Command
Learning how to run an external command from inside python is fairly straightforward. Python supports several methods for calling an external command. Determining which method to use depends on the use case, view our examples below of calling an external command. Use subprocess.call() The recommended way to execute an external command in Python is by using the subprocess module. The example below uses the call() method to invoke...
Python - Convert int to string
One of the most common Python programming questions is, how do I convert strings to integers or integers to strings? Python int to string is a very common conversion. Check out our examples below to learn how to convert int to string using Python. If you need to convert bytes to string, have a look at our other Python post. Convert int to string using str() The str() method...
Python - Using global variables in a function
A few of the most common Python questions revolve around global variables. How can I create or use a global variable in a function? If you create a global variable in one function, how can it be used as a global variable in another function? Check out our example of using global variables in a function below. testvar = 0 def set_testvar_to_one(): global...