• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
PythonForBeginners.com

PythonForBeginners.com

Learn By Example

  • Home
  • Python Tutorial
  • Python Basics
  • Python Code Examples


Code Snippets

Review our python code snippet articles below. We have covered so many examples it may take you awhile to browse them all. Feel free to use our search for a specific python coding example.

Python Code: Calculate the average score

Last Updated: August 28, 2020

Overview This script will calculate the average of three values. Make sure to put in "int" before the raw_input function, since we are using … [Read more...] about Python Code: Calculate the average score

Filed Under: Code Snippets, Scripts Date Originally Published: September 22, 2012

Python Calendar : Show calendars

Last Updated: August 28, 2020

This script will ask for an input of a year. It will then take that input and return the calendar for that entire year. import calendar print "Show a … [Read more...] about Python Calendar : Show calendars

Filed Under: Calendar, Code Snippets Date Originally Published: September 21, 2012

Urllib2 – User Agent

Last Updated: August 27, 2020

Overview This post will show how to add headers to a HTTP request. By default urllib2 identifies itself as Python-urllib/2.7 : GET / HTTP/1.1" … [Read more...] about Urllib2 – User Agent

Filed Under: Code Snippets, Network, urllib Date Originally Published: September 21, 2012

Python Join Examples

Last Updated: August 27, 2020

Overview This post will show some examples of the Python join method. What is important to remember is that the character that joins the elements is … [Read more...] about Python Join Examples

Filed Under: Code Snippets, Data Types, Join Date Originally Published: September 20, 2012

Check your external IP address

Last Updated: August 28, 2020

Overview This is a simple Python script to check which external IP address you have. First we are importing the urllib and re modules. Check your IP … [Read more...] about Check your external IP address

Filed Under: Code Snippets, Scripts Date Originally Published: September 20, 2012

Python Hangman Game

Last Updated: August 27, 2020

Overview This is a Python script of the classic game "Hangman". The word to guess is represented by a row of dashes. If the player guess a letter … [Read more...] about Python Hangman Game

Filed Under: Code Snippets, Games, Scripts Date Originally Published: September 20, 2012

Python Command Line IMDB Scraper

Last Updated: August 27, 2020

Overview This script will ask for a movie title and a year and then query IMDB for it. Command Line IMDB Scraper First step is to import the necessary … [Read more...] about Python Command Line IMDB Scraper

Filed Under: Code Snippets, crawler Date Originally Published: September 19, 2012

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 3
  • Go to page 4
  • Go to page 5

Primary Sidebar

Get Our Free Guide To Learning Python

Menu

  • Python Basics
  • Code Examples
  • Loops
  • Functions
  • Strings
  • Python on the Web
  • Lists
  • Dictionaries
  • Python Modules
  • Python Glossary
  • Learn Python

Most Popular Content

  • Reading and Writing Files in Python
  • String Concatenation and Formatting
  • List Comprehensions in Python
  • How to use sys.argv in Python
  • How to use Split in Python
  • How to use comments in Python
  • Python Syntax Basics

Recent Posts

  • Datacamp Review 2020
  • Most Common Python Interview Questions For 2020
  • Python 2 Vs Python 3 with Examples
  • How To Run Your Python Scripts
  • The 5 Best Python IDE’s and Code Editors for 2019

Python Courses

  • Datacamp: Intro To Python
  • 2021 Complete Python Bootcamp
  • Python Mega Course: Build 10 Real World Apps
  • Python Data Science Bootcamp
  • Complete Python Developer: Zero to Mastery

Copyright © 2012–2021 ยท PythonForBeginners.com

  • Home
  • Contact Us
  • Privacy Policy
  • Write For Us