Welcome to Python for Beginners

Welcome to Python for beginners where you can learn Python the easy way. To give you a quick start of Python, we have put together Cheat Sheets. You can find these at the top of the site. If you want to see a site overview, you can use the Sitemap in upper right corner. The ...

Development Environment in Python

Overview Some of the steps needed to setup a development environment includes: Operating system - e.g Linux / Mac Project structure - project structure Virtualenv - isolated installation of the project Pip - a tool for installing and managing Python packages Git - source control Webserver - where we can manage our applications Fabric - ...

Using pywhois

What is pywhois? pywhois is a Python module for retrieving WHOIS information of domains. pywhois works with Python 2.4+ and no external dependencies [Source] Installation The installation of pywhois is done through the pip command. pip install python-whois >>> import whois >>> pywhois Usage We can use the pywhois module to query a WHOIS server ...

How to use sh in Python

What is sh? sh is a unique subprocess wrapper that maps your system programs to Python functions dynamically. sh helps you write shell scripts in Python by giving you the good features of Bash (easy command calling, easy piping) with all the power and flexibility of Python. [source] Starting with sh sh is a full-fledged ...

With statement in Python

Overview In Python you need to give access to a file by opening it. You can do it by using the open() function. Open returns a file object, which has methods and attributes for getting information about and manipulating the opened file. With statement With the "With" statement, you get better syntax and exceptions handling. ...

Tweet Search with Python

Overview Twitter's API is REST-based and will return results as either XML or JSON, as well as both RSS and ATOM feed formats. Public timelines can be accessed by any client, but all other Twitter methods require authentication. About this script The program is well documented and should be straightforward. Open up a text editor, ...

Dictionary Manipulation in Python

Overview A dictionary is a collection of key-value pairs. A dictionary is a set of key:value pairs. All keys in a dictionary must be unique. In a dictionary, a key and its value are separated by a colon. The key, value pairs are separated with commas. The key & value pairs are listed between curly ...

Magic 8-ball written in Python

Overview The Magic 8 Ball is a toy used for fortune-telling or seeking advice. Magic 8-ball written in Python In this script I'm using 8 possible answers, but please feel free to add more as you wish. There are 20 answers inside the Magic 8 Ball, and you can find them all here # Import ...

String Manipulation in Python

Overview A string is a list of characters in order. A character is anything you can type on the keyboard in one keystroke, like a letter, a number, or a backslash. Strings can have spaces: "hello world". An empty string is a string that has 0 characters. Python strings are immutable Python recognize as strings ...

List Manipulation in Python

Overview List is one of the simplest and most important data structures in Python. Lists are enclosed in square brackets [ ] and each item is separated by a comma. Lists are collections of items where each item in the list has an assigned index value. A list is mutable, meaning you can change its ...

Python Code Snippets

Code Snippets CommandLineFu with Python Port Scanner in Python Google Command Line Script Date and Time Script SSH Connection with Python Bitly Shortener Using Python to Send Email Command Line speedtest.net via tespeed Find all mp3 files with os.walk and fnmatch Show the most popuplar videos on YouTube Backup all MySQL databases, with timestamp. Get ...