python-cheat-sheet-v1

python-cheat-sheet-v1 - sys Variables argv byteorder...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Class Special Methods __new__(cls) __init__(self, args) __del__(self) __repr__(self) __str__(self) __cmp__(self, other) __index__(self) __hash__(self) __getattr__(self, name) __getattribute__(self, name) __setattr__(self, name, attr) __delattr__(self, name) __call__(self, args, kwargs) String Methods capitalize() * center(width) count(sub, start, end) decode() encode() endswith(sub) expandtabs() find(sub, start, end) index(sub, start, end) isalpha() * islower() * istitle() * join() lower() * sys Variables argv builtin_module_names byteorder check_interval exec_prefix executable exitfunc modules path stdin, stdout, stderr winver os Variables altsep curdir defpath devnull extsep linesep name pathsep Indexes and Slices (of a=[0,1,2,3,4,5]) len(a) a[0] a[5] a[-1] a[-2] a[1:] a[:5] a[1:3] b=a[:] 6 0 5 5 4 [1,2,3,4,5] [0,1,2,3,4] [1,2] Shallow copy of a Date Formatting (strftime and strptime) %a %A %b %B %c %d %H %I %j %m %M %p %S %U %w %W %x %y %Y %Z %% 1. 2. 3. 4. Abbreviated weekday (Sun) Weekday (Sunday) Abbreviated month name (Jan) Month name (January) Date and time Day (leading zeros) (01 to 31) 24 hour (leading zeros) (00 to 23) 12 hour (leading zeros) (01 to 12) Day of year (001 to 366) Month (01 to 12)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online