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

PythonForBeginners.com

Learn By Example

  • Home
  • Learn Python
    • Python Tutorial
  • Categories
    • Basics
    • Lists
    • Dictionary
    • Code Snippets
    • Comments
    • Modules
    • API
    • Beautiful Soup
    • Cheatsheet
    • Games
    • Loops
  • Python Courses
    • Python 3 For Beginners

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.

Log Checker in Python

Author: PFB Staff Writer
Last Updated: August 27, 2020

Show all entries in a logfile This script will show all entries in the file that is specified in the log file variable. Log Checker Script In this … [Read more...] about Log Checker in Python

Filed Under: Code Snippets, Scripts Author: PFB Staff Writer

Python : Guessing Game part 2

Author: PFB Staff Writer
Last Updated: July 15, 2021

Overview This small program extends the previous guessing game I wrote about in this : post "Python Guessing Game". Guessing Game In this game we will … [Read more...] about Python : Guessing Game part 2

Filed Under: Code Snippets, Games, Scripts Author: PFB Staff Writer

Guessing Game Implementation in Python

Author: PFB Staff Writer
Last Updated: December 28, 2022

Writing simple games in python is a great way to practice conditional statements and loops. In this article, we will implement a guessing game in … [Read more...] about Guessing Game Implementation in Python

Filed Under: Code Snippets, Games Author: PFB Staff Writer

How to use Strings Count Method

Author: PFB Staff Writer
Last Updated: May 25, 2020

Count Occurrences of a string This small script will use Pythons count method to count the numberof occurrences of a string. s = "Count, the number … [Read more...] about How to use Strings Count Method

Filed Under: Code Snippets Author: PFB Staff Writer

Python Password Generator

Author: PFB Staff Writer
Last Updated: August 28, 2020

Password Generator You can use Pythons string and random modules to generate passwords. The string module contains a number of useful constants and … [Read more...] about Python Password Generator

Filed Under: Code Snippets, Scripts Author: PFB Staff Writer

Using Telnet in Python

Author: PFB Staff Writer
Last Updated: August 28, 2020

Using Telnet in Python To make use of Telnet in Python, we can use the telnetlib module. That module provides a Telnet class that implements the … [Read more...] about Using Telnet in Python

Filed Under: Code Snippets, telnet Author: PFB Staff Writer

Python Code : Convert KM/H to MPH

Author: PFB Staff Writer
Last Updated: August 27, 2020

Convert KM/H to MPH This script converts speed from KM/H to MPH, which may be handy for calculating speed limits when driving abroad, especially for … [Read more...] about Python Code : Convert KM/H to MPH

Filed Under: Code, Code Snippets Author: PFB Staff Writer

Split a domain with urlparse

Author: PFB Staff Writer
Last Updated: August 27, 2020

Split a domain This is a simple script to split the domain name from a URL. It does that by usingPythons urlparse module. import urlparse url = … [Read more...] about Split a domain with urlparse

Filed Under: Code Snippets Author: PFB Staff Writer

Python Code : Get all the links from a website

Author: PFB Staff Writer
Last Updated: August 28, 2020

Overview In this script, we are going to use the re module to get all links from any website. One of the most powerful function in the re module is … [Read more...] about Python Code : Get all the links from a website

Filed Under: Code, Code Snippets, crawler, Python On The Web Author: PFB Staff Writer

Python Code: Celsius and Fahrenheit Converter

Author: PFB Staff Writer
Last Updated: August 27, 2020

Overview This script converts temperature between Fahrenheit to Celsius. To create a python converter for celsius and fahrenheit, you first have to … [Read more...] about Python Code: Celsius and Fahrenheit Converter

Filed Under: Code Snippets, Scripts Author: PFB Staff Writer

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Go to Next Page »

Primary Sidebar

Menu

  • Basics
  • Cheatsheet
  • Code Snippets
  • Development
  • Dictionary
  • Error Handling
  • Lists
  • Loops
  • Modules
  • Scripts
  • Strings
  • System & OS
  • Web

Get Our Free Guide To Learning Python

Most Popular Content

  • Reading and Writing Files in Python
  • Python Dictionary – How To Create Dictionaries In Python
  • How to use Split in Python
  • Python String Concatenation and Formatting
  • List Comprehension in Python
  • How to Use sys.argv in Python?
  • How to use comments in Python
  • Try and Except in Python

Recent Posts

  • Count Rows With Null Values in PySpark
  • PySpark OrderBy One or Multiple Columns
  • Select Rows with Null values in PySpark
  • PySpark Count Distinct Values in One or Multiple Columns
  • PySpark Filter Rows in a DataFrame by Condition

Copyright © 2012–2025 · PythonForBeginners.com

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