-
Notifications
You must be signed in to change notification settings - Fork 1
Ex22: Python symbol list
RachyJ edited this page Aug 4, 2017
·
5 revisions
First, go back through every exercise you have done so far and write down every word and symbol (another name for “character”) that you have used. Make sure your list of symbols is complete.
Next to each word or symbol, write its name and what it does. If you can’t find a name for a sym- bol in this book, then look for it online. If you do not know what a word or symbol does, then go read about it again and try using it in some code.
- def: define a function
- add: do math add
- subtract: -
- multiply: *
- divide: /
- print: print a string
- %: to specify a variable
- %d: decimal
- %s: string
- %r: raw; good for debugging
- from sys import argv: import a function from a library
- read(): read a file
- readline(): read a line from a file
- seek(): move to the specified byte of a file
- open(): open a local file
- open(filename, 'w'): open a file in write mode
- open(filename, 'r'): open a file in read mode
- write(): write data to a file
- close(): close a file
- +=: x=x+y
- int(): convert the input to int
- (*args): asterisk args, argv parameter for functions
- len(): get the length
- exists(): check if a file exists
- raw_input(): get input using the keyboard
- argv: argument variable; get inputs on the command line
- truncate(): trucate a file by the specified size
- """ """: multiline string
- q: quit
- pandoc: check documentation
- : escape sequence
- \ Backslash ()
- ' Single-quote (') " Double-quote (")
- \a ASCII bell (BEL)
- \b ASCII backspace (BS)
- \f ASCII formfeed (FF)
- \n ASCII linefeed (LF)
- \N{name} Character named name in the Unicode database (Unicode only) \r ASCII carriage return (CR)
- \t ASCII horizontal tab (TAB)
- \uxxxx Character with 16-bit hex value xxxx (Unicode only) \Uxxxxxxxx Character with 32-bit hex value xxxxxxxx * * (Unicode only) \v ASCII vertical tab (VT)
- \ooo Character with octal value oo
- \xhh Character with hex value hh
- +: plus
- -: minus
- /: slash
- *: asterisk
- %: percent
- <: less than
- ''>:'' greater than
- <=: less-than-equal
- ''>=: greater-than-equal