Instant Python

This is a minimal crash-course in the programming language Python. To learn more, take a look at the documentation at the Python web site, www.python.org; especially the tutorial. If you wonder why you should be interested, check out the comparison page where Python is compared to other languages. This introduction has been translated into several languages, among them Portuguese, Italian, Spanish, Russian, French, Lithuanian, Japanese, German and Greek, and is currently being translated into Norwegian, Polish, and Korean. Note: To get the examples working properly, write the programs in a text file and then run that with the interpreter; do not try to run them directly in the interactive interpreter - not all of them will work. To begin with, think of Python as pseudo-code. x,y,z = 1,2,3 first, second = second, first a = b = 123 Blocks are indicated through indentation, and only through indentation. The first two examples are equivalent. Notice that the end is non-inclusive. print a or b
BeginnersGuide/Programmers
This is a Wiki page. Users with edit rights can edit it. You are, therefore, free to (in fact, encouraged to) add details of material that other Python users will find useful. A beginner-friendly Python tutorial that starts with the absolute basics but also covers more advanced stuff like Python software deployment.
Tutorial - py2exe.org
py2exe turns Python programs into packages that can be run on other Windows computers without needing to install Python on those computers. You must run py2exe on a Windows computer. Python is needed on the computer where py2exe itself is run because py2exe is a Python program and it includes parts of Python in the package that is built. To successfully complete this tutorial you'll need to know the basics of Python (you can get started at python.org's getting started page). You'll also need to know how to run Python programs from the command prompt. Install py2exe on your Windows computer using pip: pip install py2exe There are a few simple steps needed to use py2exe once you've installed it: 1. The biggest step is almost always the first one. It's important that you make sure everything is working before you use py2exe. The first example we'll use here is our old friend... hello.py We need to make sure it's working... C:\Tutorial>python hello.py Hello World! Looks good! 2. setup.py 3. 4. 5.
python - IRC bot functionalities
A simple IRC BOT written in Python - This article shows you how to make a simple IRC bot in python.
First question: why the hell not eggdrop? Answer: I don't know TCL, and I like to customize my scripts; plus it's a heavy program, and I hardly need 1% of the features it provides. I have been using python for a few months now and absoulutely love it. Creating bots in python is quite a simple job really. Importing the libraries: import sys import socket import string import os #not necassary but later on I am going to use a few features from this With that done, now we need to give a configuration: HOST='mesa.az.us.undernet.org' #The server we want to connect to PORT=6667 #The connection port which is usually 6667 NICK='pybotv000' #The bot's nickname IDENT='pybot' REALNAME='s1ash' OWNER='ne0n-' #The bot owner's nick CHANNELINIT='#test198' #The default channel for the bot readbuffer='' #Here we store all the messages from server Warning:Keep the nickname quite unique because then you'll have to use a method to change the nick if it is already taken. Connecting to the server: while 1: :nick!
Simple Python IRC Bot
#!/usr/bin/env python# This code was written for Python 3.1.1# version 0.101# Changelog:# version 0.100# Basic framework## version 0.101# Fixed an error if an admin used a command with an argument, that wasn't an admin-only commandimport socket, sys, threading, time# Hardcoding the root admin - it seems the best way for nowroot_admin = "maslen"# Defining a class to run the server. One per connection.
s Python Class - Google's Python Class - Google Code
Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. To get started, the Python sections are linked at the left -- Python Set Up to get Python installed on your machine, Python Introduction for an introduction to the language, and then Python Strings starts the coding material, leading to the first exercise. This material was created by Nick Parlante working in the engEDU group at Google. Tip: Check out the Python Google Code University Forum to ask and answer questions.
Getting Started - Google APIs Client Library for Python
import BaseHTTPServerimport Cookieimport httplib2import StringIOimport urlparseimport sys from apiclient.discovery import buildfrom oauth2client.client import AccessTokenRefreshErrorfrom oauth2client.client import OAuth2WebServerFlowfrom oauth2client.file import Storage class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Child class of BaseHTTPRequestHandler that only handles GET request.""" # Create a flow object. def do_GET(self): """Handler for GET request.""" print '\nNEW REQUEST, Path: %s' % (self.path) print 'Headers: %s' % self.headers # To use this server, you first visit # # When you redirect to the authorization server below, it redirects back # to to def handle_initial_url(self): """Handles the initial path.""" # The fake user name should be in the URL query parameters. fake_user = self.get_fake_user_from_url_param() # Set the necessary headers to respond with the redirect. if __name__ == '__main__': main()
Related:
Related: