Python-cheat-sheet-v1.pdf
String Methods capitalize() * center(width)count(sub, start, end)
Datetime Methods lstrip() partition(sep) replace(old, new) rfind(sub, start ,end) rindex(sub, start, end) rjust(width) rpartition(sep) rstrip() split(sep) splitlines()startswith(sub) strip() swapcase() * title() * translate(table) upper() * zfill(width) Date Formatting (strftime and strptime) %a Abbreviated weekday (Sun) %A Weekday (Sunday) %b Abbreviated month name(Jan) %B Month name (January) %c Date and time Time Methods replace() isoformat() __str__() strftime(format) utcoffset() dst() tzname() today() now(timezoneinfo) utcnow() fromordinal(ordinal)combine(date, time) strptime(date, format)
builtin_module_names Linked C modules
decode() encode() endswith(sub) expandtabs()
index(sub, start, end)
fromtimestamp(timestamp) utcfromtimestamp(timestamp)find(sub, start, end) rsplit(sep) isalnum() * isalpha() * isdigit() * islower() * isspace() * istitle() * isupper() * join() ljust(width) lower() *
Methods marked * are locale dependant for 8-bitstrings.
sys.argv for $ python foo.py bar -c qux --h sys.argv[0] sys.argv[1] sys.argv[2] sys.argv[3] sys.argv[4] foo.py bar -c qux --h
Note
%d Day (leading zeros) (01 to 31) %H 24 hour(leading zeros) (00 to 23) %I 12 hour (leading zeros) (01 to 12) %j Day of year (001 to 366)
os Variables altsep curdir defpath devnull extsep linesep name pardir pathsep sep Alternative sep Current dirstring Default search path Path of null device Extension separator Line separator Name of OS Parent dir string Patch separator Path separator
Registered OS names: “posix”, “nt”, “mac”, “os2”,...
Regístrate para leer el documento completo.