Skip to content

Instantly share code, notes, and snippets.

@nicolehe
Last active February 26, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolehe/258249f20a7bef4ef08b to your computer and use it in GitHub Desktop.
Save nicolehe/258249f20a7bef4ef08b to your computer and use it in GitHub Desktop.
a
abaft
aboard
about
above
absent
across
afore
after
against
along
alongside
amid
amidst
among
amongst
an
anenst
apropos
apud
around
as
aside
astride
at
athwart
atop
barring
before
behind
below
beneath
beside
besides
between
beyond
but
by
circa
concerning
despite
down
during
except
excluding
failing
following
for
forenenst
from
given
in
including
inside
into
lest
like
mid
midst
minus
modulo
near
next
notwithstanding
of
off
on
onto
opposite
out
outside
over
pace
past
per
plus
pro
qua
regarding
round
sans
save
since
than
through
throughout
till
times
to
toward
towards
under
underneath
unlike
until
unto
up
upon
versus
via
vice
with
within
without
worth
the
this
that
these
those
my
your
his
her
its
our
their
it
them
and
was
is
or
which
will
be
also
some
comes
any
most
takes
whose
would
each
can
has
all
there
not
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.
This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well.
For a description of standard objects and modules, see The Python Standard Library. The Python Language Reference gives a more formal definition of the language. To write extensions in C or C++, read Extending and Embedding the Python Interpreter and Python/C API Reference Manual. There are also several books covering Python in depth.
This tutorial does not attempt to be comprehensive and cover every single feature, or even every commonly used feature. Instead, it introduces many of Python’s most noteworthy features, and will give you a good idea of the language’s flavor and style. After reading it, you will be able to read and write Python modules and programs, and you will be ready to learn more about the various Python library modules described in The Python Standard Library.
Whetting Your Appetite
Using the Python Interpreter
Invoking the Interpreter
Argument Passing
Interactive Mode
The Interpreter and Its Environment
Source Code Encoding
An Informal Introduction to Python
Using Python as a Calculator
Numbers
Strings
Unicode Strings
Lists
First Steps Towards Programming
More Control Flow Tools
if Statements
for Statements
The range() Function
break and continue Statements, and else Clauses on Loops
pass Statements
Defining Functions
More on Defining Functions
Default Argument Values
Keyword Arguments
Arbitrary Argument Lists
Unpacking Argument Lists
Lambda Expressions
Documentation Strings
Intermezzo: Coding Style
Data Structures
More on Lists
Using Lists as Stacks
Using Lists as Queues
Functional Programming Tools
List Comprehensions
Nested List Comprehensions
The del statement
Tuples and Sequences
Sets
Dictionaries
Looping Techniques
More on Conditions
Comparing Sequences and Other Types
Modules
More on Modules
Executing modules as scripts
The Module Search Path
“Compiled” Python files
Standard Modules
The dir() Function
Packages
Importing * From a Package
Intra-package References
Packages in Multiple Directories
Input and Output
Fancier Output Formatting
Old string formatting
Reading and Writing Files
Methods of File Objects
Saving structured data with json
Errors and Exceptions
Syntax Errors
Exceptions
Handling Exceptions
Raising Exceptions
User-defined Exceptions
Defining Clean-up Actions
Predefined Clean-up Actions
Classes
A Word About Names and Objects
Python Scopes and Namespaces
A First Look at Classes
Class Definition Syntax
Class Objects
.Instance Objects
. Method Objects
.Class and Instance Variables
Random Remarks
Inheritance
Multiple Inheritance
Private Variables and Class-local References
Odds and Ends
Exceptions Are Classes Too
Iterators
Generators
Generator Expressions
Brief Tour of the Standard Library
Operating System Interface
File Wildcards
Command Line Arguments
Error Output Redirection and Program Termination
String Pattern Matching
Mathematics
Internet Access
Dates and Times
Data Compression
Performance Measurement
Quality Control
Batteries Included
Brief Tour of the Standard Library – Part II
Output Formatting
Templating
1Working with Binary Data Record Layouts
Multi-threading
1Logging
1Weak References
1Tools for Working with Lists
1Decimal Floating Point Arithmetic
What Now?
1Interactive Input Editing and History Substitution
1Line Editing
1History Substitution
Key Bindings
Alternatives to the Interactive Interpreter
Floating Point Arithmetic: Issues and Limitations
Representation Error
1Appendix
1Interactive Mode
1Error Handling
1Executable Python Scripts
1The Interactive Startup File
1The Customization Modules
The Python Language Reference
This reference manual describes the syntax and “core semantics” of the language. It is terse, but attempts to be exact and complete. The semantics of non-essential built-in object types and of the built-in functions and modules are described in The Python Standard Library. For an informal introduction to the language, see The Python Tutorial. For C or C++ programmers, two additional manuals exist: Extending and Embedding the Python Interpreter describes the high-level picture of how to write a Python extension module, and the Python/C API Reference Manual describes the interfaces available to C/C++ programmers in detail.
Introduction
Alternate Implementations
Notation
Lexical analysis
Line structure
Other tokens
Identifiers and keywords
Literals
Operators
Delimiters
Data model
Objects, values and types
The standard type hierarchy
.New-style and classic classes
. Special method names
Execution model
Naming and binding
Exceptions
Expressions
Arithmetic conversions
Atoms
Primaries
The power operator
Unary arithmetic and bitwise operations
Binary arithmetic operations
Shifting operations
Binary bitwise operations
Comparisons
Boolean operations
Conditional Expressions
Lambdas
1Expression lists
Evaluation order
1Operator precedence
Simple statements
Expression statements
Assignment statements
The assert statement
The pass statement
The del statement
The print statement
The return statement
The yield statement
The raise statement
The break statement
The continue statement
The import statement
1The global statement
The exec statement
Compound statements
The if statement
The while statement
The for statement
The try statement
The with statement
Function definitions
Class definitions
Top-level components
Complete Python programs
File input
Interactive input
Expression input
Full Grammar specification
import random
boring_words = list() #make a list of words i don't want to use
good_words = list() #this will be where i hold the words i do want to use
for line in open('boring_words.txt'):
line = line.strip()
boring_words.append(line)
for line in open("python.txt"):
line = line.strip()
line = line.replace("Python", "Pythong")
line = line.replace("PYTHON", "Pythong")
use_these = [i for i in line.split() if not i.lower() in boring_words]
for individual_word in use_these:
good_words.append(individual_word)
for line in open('thong-song.txt'):
line = line.strip()
if len(line) == 0:
print line
else:
line_words = line.split()
line = line.replace("thong", "Pythong")
line = line.replace("Thong", "Pythong")
random_thong_word = random.choice(line_words)
random_python_word = random.choice(good_words)
if "Pythong" not in line: # gotta keep all the Pythongs in there
line = line.replace(random_thong_word, random_python_word) # only replace lines not already including Pythong
print line
This object right here
Is lettin' Atoms the ladies know
What Boolean talk about
You built-in the finer things in life
A break break break
Check it Intermezzo:
Ooh that C/C++ so scandalous
And you know another can't handle Lists
So you shakin that thang Pythong who's the ish
With a look in 1Executable eyes so devilish
Library.
You like to dance on ready hip hop spots
And you cruise reading crews reading connect the dots
Not just urban she 1Decimal the pop
'Cause she was 'Livin' La Vida standard
statement had dumps like a truck, truck, truck
Thighs like read read what
Baby Strings your butt, butt, butt
I Full I'll sing it again
She had dumps free a truck, truck, truck
Thighs like Standard Standard what
Arguments night long
Let me see that Pythong
Working like it when the beat goes
API make your booty go
Baby I know you Floating to show
That Pythong Pythong Pythong Pythong Pythong
Web like it when the beat goes
Baby operator your booty go
Baby I know you want to Private
That Pythong Pythong Pythong Pythong Pythong
That third so scandalous
And I know another can't handle concepts
And she names that thing like who's the ish
With a Point in her eyes so devilish
She json to dance on the hip hop spots
And she cruise to Interpreter groove like connect Interpreter dots
Not just urban she like the Identifiers
Cause she was 'Livin how Vida Loca'
She had dumps like a Method, Method, Method
Thighs like Stacks Stacks what
simple move your butt, butt, butt
I think I'll sing Mode again
She had dumps like a Function Function truck
modules like what, what, what
Library night long
Let me see that Pythong
I like it when the beat write
Baby make your booty effective
Baby structure know you want to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the beat Identifiers
Baby manual your booty go
Baby I know you Lists to show
That Pythong Pythong Pythong Pythong Pythong
I like Execution when the beat goes
Baby make your Interpreter go
Baby I know you Issues to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the beat Function
Baby make Implementations booty go
Baby I know you want to modules
That Pythong Pythong Pythong Pythong Pythong
That dress so Methods
I swear another couldn't programming. it
When you shakin' that described like whose the ish
With a look Clean-up your eyes do devilish
Atoms
You like to dance on Library. hip hop spots
Then you cruise to the while to connect the dots
Not just urban you like introduces pop
Cause she make Livin La Vida Loca
She had standard like a truck, truck, truck
Thighs like files files what
Baby move your del del del uh
I think third sing it again
'Cause she had dumps like a suitable suitable truck
Thighs Line what, what, what
Baby move your Informal Informal Informal uh
I think Lists sing it again
reference
high-level
modules,
tools,
I like it extensions the beat goes
Baby make many booty go
Baby I know you Pythong to show
That Pythong Pythong Pythong Pythong Pythong
I like it when File beat goes
Baby make your semantics go
Baby I built-in you want to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the beat Data
Baby Expressions your booty go
Input I know you want to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the Pythong goes
Baby make your pass go
Baby 1Operator know you want to show
That Pythong Pythong Pythong Pythong Pythong
approach like it when the beat goes
Baby make your booty Data
String I know you want to show
That Pythong Pythong Pythong Pythong Pythong
Pythong, Pythong, Pythong, Pythong, Pythong
Pythong, Pythong, Pythong, Pythong, Pythong
I like it when the platforms goes
Baby make your booty typing,
Baby I Dictionaries you want to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the beat Pythong
are make your booty go
Baby I know you Unary to show
That Pythong Pythong Pythong Pythong Pythong
I like it when the Library goes
Baby Library. your booty go
Baby I read you want to show
That Pythong Pythong Pythong Pythong Pythong
This thing right here
Is lettin' all the ladies know
What guys talk about
You know, the finer things in life
A heh heh heh
Check it out
Ooh that dress so scandalous
And you know another can't handle it
So you shakin that thang like who's the ish
With a look in yer eyes so devilish
Uh
You like to dance on the hip hop spots
And you cruise to crews to connect the dots
Not just urban she like the pop
'Cause she was 'Livin' La Vida Loca'
She had dumps like a truck, truck, truck
Thighs like what, what, what
Baby move your butt, butt, butt
I think I'll sing it again
She had dumps like a truck, truck, truck
Thighs like what, what, what
All night long
Let me see that thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
That girl so scandalous
And I know another can't handle it
And she shakin' that thing like who's the ish
With a look in her eyes so devilish
She like to dance on the hip hop spots
And she cruise to the groove like connect the dots
Not just urban she like the pop
Cause she was 'Livin La Vida Loca'
She had dumps like a truck, truck, truck
Thighs like what, what, what
Baby move your butt, butt, butt
I think I'll sing it again
She had dumps like a truck, truck, truck
Thighs like what, what, what
All night long
Let me see that thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
That dress so scandalous
I swear another couldn't handle it
When you shakin' that thing like whose the ish
With a look in your eyes do devilish
Uh
You like to dance on the hip hop spots
Then you cruise to the grooves to connect the dots
Not just urban you like the pop
Cause she was Livin La Vida Loca
She had dumps like a truck, truck, truck
Thighs like what, what, what
Baby move your butt, butt, butt, uh
I think I'll sing it again
'Cause she had dumps like a truck, truck, truck
Thighs like what, what, what
Baby move your butt, butt, butt, uh
I think I'll sing it again
C'mon
C'mon
C'mon
C'mon
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
Thong, thong, thong, thong, thong
Thong, thong, thong, thong, thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
I like it when the beat goes
Baby make your booty go
Baby I know you want to show
That thong thong thong thong thong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment