Manual de phyton

Páginas: 3 (616 palabras) Publicado: 7 de abril de 2011
Python Quick Reference
OPERATOR PRECEDENCE IN EXPRESSIONS Operator `expr,...` {key:expr,...} [expr,...] (expr,...) f(expr,...) x[index:index] x[index] x.attr x**y ~x +x, -x x*y, x/y, x//y, x%y x+y,x-y xy x&y x^y x|y x=y xy, x!=y, x==y x is y, x is not y x in y, x not in y not x x and y x or y lambda arg,...: expr Description String conversion Dictionary creation List creation Tuple creation orsimple parentheses Function call Slicing Indexing Attribute reference Exponentiation (x to yth power) Bitwise NOT Unary plus and minus Multiplication, division, remainder Addition, subtractionLeft-shift, right-shift Bitwise AND Bitwise XOR Bitwise OR Comparisons Equality/inequality tests* Identity tests Membership tests Boolean NOT Boolean AND Boolean OR Anonymous simple function A NA NA NA NA LL L L R NA NA L L L L L L C C C C NA L L NA

* x!=y and xy are the same inequality test (!= is the preferred form, obsolete) A – Associativity L – Left R – Right C – Chaining NA – Not associativeLIST OBJECT METHODS Description Returns the number of occurrences of x in L Returns the index of the first occurrence of x in L or raises an exception if L has no such item Appends x to the end of LAppends all the items of list l to the end of L Inserts x at index i in L Removes the first occurrence of x from L Returns the value of the item at index i and removes it from L Reverses, in-place, theitems of L Sorts, in-place, the items of L, comparing items by f

Operator L.count(x) L.index(x) L.append(x) L.extend(l) L.insert(i,x) L.remove(x) L.pop(i=-1) L.reverse( ) L.sort(f=cmp)

Excerptedfrom Python in a Nutshell

www.oreilly.com

Python Quick Reference
COMMON FILE OPERATIONS Operation Interpretation output = open('/tmp/spam', 'w') Create output file ('w' means write). input =open('data', 'r') Create input file ('r' means read). S = input.read( ) Read entire file into a single string. S = input.read(N) Read N bytes (1 or more). S = input.readline( ) Read next line...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Manual de phyton
  • Manual phyton
  • Manual Phyton
  • Manual de codigo phyton
  • Manual De Phyton Con Db2
  • Phyton
  • Phyton
  • Phyton

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS