We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
(Orr Ceoa ey yy
so
me
wasn ly
SS
cae NEES
———
mek
‘596 argv forthe command:
S python foopy bar qux-~h
altsep Alternative sep
curr Curren sing
ofpath Default search path
dovnul Path of ul dove
extsep Extension separator
Nnesep Line separator
name Name of OS
para arent d sting
patwsop Patch separator
se. Path separator
Rogisiored OS names “posi, “nr,
‘ac’, "052", "8", ava’, "iscos™
By Dave Child (OaveChie)
choatography-comidavechl
aloneonaillcom
Python Cheat Sheet
by Dave Child (DaveChild) via cheatography.com//es/19/
_rew_(els) 1G other
—int_{set args) lt ather)
—el_tsel —at_{sol, tren)
—ree_{sel)
(sel
—tmp_{eatt, eter) _ne_{se other
__indox_(sot) ——_nonzero_(set)
_Pash_(sot)
—etatt_{et, name)
—getartibut
tat.
»_{sel, namo)
3, name, att)
_elatr_{selt, name)
call_{sol args, kwargs)
Goons
apporditom) pop(ecston)
counter) remove(tem)
‘xtondtst) reverse)
Indox(tor) sort)
Inseripositon, tem)
En
captalize()*| bsr90)
ccenerwith) parion(sep)
count(sub, stat, replace(al, new)
enc)
decodet) sfindsub, start)
encode) rindextsub,
cena)
fencewtnsub) usw)
cexpanctabe() patton(eep)
‘indfeu, stan, end) rspli(sep)
Indox(sub, star, sti)
ona)
‘salnam)* slisep)
‘salpha* saltines()
‘dig * startowitysub)
‘slowert)" stp
‘sspaco()* swapcase()"
Published 19! October, 2011
Last updates 3rd November, 2020.
Page tof 2
Python String Methods (cont)
ratleg Weg
‘supper * translatetable)
roing upper) *
ustwiah) twits)
lower)"
‘Matnods marked are fale dependant fr
abt stings.
Eo
closet) readinessize)
hush seekioteet)
fleno() tell)
tsaty tnuncate(size)
ext wrte(sting)
‘cadsze) itelinestit)
adlnesize)
olen
tenia) 8
fo) °
ats) 5
at] 5
at] ‘4
att [23.481
ats) [o.1294)
aba) e123)
ats} fal
att] 1123.4)
Deal] Shalow copy ofa
Trdones and Sloos of a[0.1.284.5)
oe
today) ‘romordinalordial)
owitimezoneinte) —combine(date time)
enow() stipime(date, form)
‘tomtimestamp(timestamp)
Lctromtmestampitimestamp)
‘Sponsored by Readable.com
Measure your website readabity!
hip:treadable.comPython Cheat Sheet
by Dave Child (DaveChild) via cheatography.com//es/19/
So
OTe Ueeyeae yyy
replace() coteet)
leoformat() ditt
a) tznamet)
stetime(formal)
Python Dato Formatting
%a Abbreviated weekay (Sun)
%A Weekday (Sunday)
2 Abbrevated month name (Jan)
%8 Month name (anuaty)
Date and time
%d——_Day leading zeros) (01 10 31)
3 24 hour (leading zeros) (0 to 28)
%1 12a loang zeros} (01 to 12)
34 Day ot year (001 0 366)
em Month (01 to 12),
Gt Minute (00 0 59)
% Amor PM
%S Second (00 to 61")
%U Week number’ (001053)
em Waele? (0t0 6)
%W Week number: (001 53)
x Date
“x Time
Sy Year without contty (00 to 99)
sy Year (2008)
2 Time zone (GT)
‘ke Altra" character
* Sunday as stan of week. All days in @ new year preceding the
frst Sunday are considered tobe in week 0
0s Sunday, 6 is Saturday.
* Monday as sar of wook. All days In a new year precoding the
frst Monday are considered tobe in week 0.
‘This snot a mistake, Range lakes account ol leap and doublo-
leap seconds
f By Dave Child (DaveCtils) Publishes 19! October, 2011 Sponsored by Readable.com
cheatography.comidavechild! Last updated Grd November, 2020. Measure your website readability!
alongonailcom Pago 2ot2 hip:tteadable.com