Make your code shorter with shortcuts optimised for golfing in Python
Install from PyPI:
$ pip install golfing-shortcuts
https://github.com/nayakrujul/golfing-shortcuts
<a href="https://github.com/nayakrujul/golfing-shortcuts"><code>golfing-shortcuts</code></a>
Appears like this: golfing-shortcuts
[`golfing-shortcuts`](https://github.com/nayakrujul/golfing-shortcuts)
Appears like this: golfing-shortcuts
[Python](https://python.org) + [`golfing-shortcuts`](https://github.com/nayakrujul/golfing-shortcuts)
Appears like this: Python + golfing-shortcuts
import s
(s
stands for "shortcuts")
Shortcut | Function |
---|---|
s.a |
any |
s.b |
bin |
s.c |
chr |
s.d |
dir |
s.e |
eval |
s.f |
filter |
s.g |
globals |
s.h |
hash |
s.i |
input |
s.j |
all |
s.k |
max |
s.l |
len |
s.m |
map |
s.n |
enumerate |
s.o |
ord |
s.p |
print |
s.q |
min |
s.r |
range |
s.s |
sum |
s.t |
type |
s.u |
locals |
s.v |
vars |
s.x |
exec |
s.y |
isinstance |
s.z |
zip |
Shortcut | Method |
---|---|
s.sc |
str.count |
s.se |
str.encode |
s.sf |
str.format |
s.si |
str.index |
s.sj |
str.join |
s.sl |
str.lower |
s.ss |
str.split |
s.su |
str.upper |
s.sz |
str.zfill |
Shortcut | Method |
---|---|
s.la |
list.append |
s.lc |
list.count |
s.le |
list.extend |
s.li |
list.index |
s.ln |
list.insert |
s.lp |
list.pop |
s.lr |
list.remove |
s.ls |
list.sort |
Shortcut | Colour String | Colour |
---|---|---|
s.cr |
'\033[1;31m' |
Red |
s.cg |
'\033[1;32m' |
Green |
s.cy |
'\033[1;33m' |
Yellow |
s.cb |
'\033[1;34m' |
Blue |
s.cm |
'\033[1;35m' |
Magenta |
s.cc |
'\033[1;36m' |
Cyan |
s.cw |
'\033[0m' |
White |
Shortcut | Function |
---|---|
s.Mac |
math.acos |
s.Mas |
math.asin |
s.Mat |
math.atan |
s.MC |
math.ceil |
s.Mc |
math.cos |
s.Md |
math.degrees |
s.Me |
math.e |
s.MF |
math.floor |
s.Mf |
math.factorial |
s.Mg |
math.gcd |
s.Ml |
math.log |
s.Mp |
math.pi |
s.Mr |
math.radians |
s.MS |
math.sqrt |
s.Ms |
math.sin |
s.Mt |
math.tan |
Shortcut | Function |
---|---|
s.Rc |
random.choice |
s.Rd |
random.seed |
s.Rg |
random.randrange |
s.Ri |
random.randint |
s.Rp |
random.sample |
s.Rr |
random.random |
s.Rs |
random.shuffle |
s.Ru |
random.uniform |
s.Rx |
random.choices |
Shortcut | Function |
---|---|
s.Sb |
string.printable |
s.Sd |
string.digits |
s.Sh |
string.hexdigits |
s.Sl |
string.ascii_lowercase |
s.So |
string.octdigits |
s.Sp |
string.punctuation |
s.St |
string.ascii_letters |
s.Su |
string.ascii_uppercase |
s.Sw |
string.whitespace |
Shortcut | Function |
---|---|
s.Ia |
itertools.accumulate |
s.Ib |
itertools.combinations |
s.Ic |
itertools.count |
s.Ih |
itertools.chain |
s.Im |
itertools.permutations |
s.Ip |
itertools.product |
s.Ir |
itertools.repeat |
s.Iw |
itertools.combinations_with_replacement |
s.Iy |
itertools.cycle |