Show Menu
Cheatography

Chiefy Python Crib Cheat Sheet (DRAFT) by

Cheat Sheet to help learn basics of Python

This is a draft cheat sheet. It is a work in progress and is not finished yet.

List Functions

ls.app­end(e)
Adds the element e to the end of list ls
ls.ext­end­(ls2)
Adds items in ls2 to the end of ls
ls.rem­ove(e)
Remove element e from list ls
ls.pop(i)
Removes the element specified at index i

String Functions

str.ti­tle()
Returns title case
str.up­per() / str.lo­wer()
Returns uppercase / lowercase
str.ca­pit­alize()
Returns string only first letter capita­lised.
str.co­unt­(str2)
Returns the number of times str2 occurs in str
str.fi­nd(­str2)
Returns index of first str2 in str. -1 if not present.
str.rf­ind­(str2)
Returns index of last str2 in str. -1 if not present.
str.sw­apcase