Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
74 views

Python Essential Shortcuts Cheatsheet

Python note

Uploaded by

Ali Shaikh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
74 views

Python Essential Shortcuts Cheatsheet

Python note

Uploaded by

Ali Shaikh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Essential Shortcuts in Python Cheat Sheet Lae eee oe Python Class Special Methods Arithmetic Operators argv dd x Command line args bullin_module- Linked C modules names byleorder Native byte order check interval Signal check frequency exec. prefix Root directory executable Name of executable exitlune Exit function name modules Loaded modules path Search path platform Current platform sidin, stdout, stderr File objects for VO version_info Python version info. appendittem) opipesition) count(item) remove(item) extend(list) reverse() index(item) sort() Insert{position, item) UAL replace) utcoftsot() Isoformat) dsi() —st_t) tenamet) sirfime(format) _new_(cls} (sel, other int_(sell, args) _le_(sell, other) _sel_(selt) _ot_(colt, other) __repr_(selt) —_ge__(sa, other) —stt_(self) —2q_(selt, other) __omp__(sel, other) __ne_(self, other) index__(self) —hash__(seit) _getatr_(self, name) _ronzero_(selt) __gotatribute_{self,name) _-setatr (self, name, att) _seattr_{selt, name) call_(self, args, kwargs) ucla eens lena) 8 a0) ° als] 5 1] 5 a2] 4 aft:] 1,2,3,4,5) 5] 0.1,23,4) at-2 (01,23) alt:3) a att] (1.234) bal] Shallow copy of a Indexes and Slices of a=[0,1,2,3,4,5] xey a -y subiract xty multiply = x/y Nido x%y modulus xy xy Assignment shortcuts: x op= y Example: x += 1 Increments x een sys.argvi0) foopy sys.argy{t] bar sys.argv2) “ sys.argu3} aux sys.argvi4) 4 sys.2tgy for the command: $ python foo. py bar-oqux—h (iin aed closet) readlines(size) flush) seek(ottset) fileno() toy) Isatty() truncate(size) next) wirit(stting) read{size) warlteines(lst) roadino(size) us aae ec capitalize() * Istripg ceenter(width) partiion(sep) count(sub, star, __replace(old, new) end) decodet) rtind(sub, start end) encode) rindex{sub, start end) ‘endsvith(sub) riustiwiath) ‘oxpandiabst) ‘parttion(s0p) find(sub, start, end) _esplitisep) isalnum() * split(sep) See” iene inliexor) Converts expr to integer istitle() * fillet) * terse? valet joing uppert)* today() fromordinal(ordinal Ijust(width)

You might also like