PythonTheHardWay Flashcards
(114 cards)
print “something”
print statement (of something in quotes)
#
pound character used to comment or disable parts of code
+
plus symbol. used to add numbers or concatenate strings
-
minus symbol. used in subtraction
/
slash symbol. used in division
*
asterisk symbol. used in multiplication
%
modulus symbol. used to get remainder in division
less-than symbol.
>
greater-than symbol
less-than-or-equal symbol
> =
greater-than-or-equal symbol
=
single-equal. assigns the value on the right to a variable on the left
==
double-equal. tests if two things have the same value
%s
string formatter
%d
number formatter
%r
raw data formatter. displays the raw data of a variable.
\n
newline symbol
\t
tab symbol
\
escape character
raw_input()
reads a line from input and converts to string
argv
the argument variable. holds the arguments passed into a script from the command line.
import
imports any Python source file as a module
open()
open a file, e.g. txt = open(filename).
read()
read the contents of a file, e.g. txt.read()