Category: Python

Python Regular Expressions

Python uses re library for regular expressions. re comes with standard python installation. Regular expressions is a very big topic. This page only covers the basics of how to search…

Python Unit Testing Example

Unit testing functionality is built into Python3. Following is a very simple example: Save this file as mycode.py. Save the following code as mycode_unittest.py When you run the unit test…

Python File Management

This page shows how to work with text files using Python3 code. Following is a sample txt file we will be using. Lets called it stocks.txt Reading from File You…

Python NumPy

NumPy is a python library that makes it easy to perform mathematical and logical operations on arrays. It provides high performance n-dimensional array object and tools to work with the…

Python code to get current date

The following code prints the current date: First we import datetime library. now() function gets the current date and time from the server. now.year, now.month, and now.day prints current year,…

Python3 for Programmers

This publication is for programmers who want to learn python. It is assumed that you know what variable, arrays, data structures, functions, etc. already are. You only need python’s syntax…

Python3 with MySQL database

If you don’t already have MySQL installed, install it with the following commands (mac only): Run the following commands to start or stop mysql. Start MySQL before proceeding: To see…