got distracted and made a repl framework.......
This commit is contained in:
parent
0a2d9a5694
commit
c18aa29c58
5 changed files with 227 additions and 17 deletions
|
|
@ -15,3 +15,14 @@ Left pad an integer's binary representation with zeros
|
|||
def lpadbin(x: int, n: int) -> str:
|
||||
return lpad(bin(x)[2:], n, pad='0')
|
||||
|
||||
'''
|
||||
Extends the standard lstrip string method,
|
||||
allowing the max: int kwarg to be supplied.
|
||||
'''
|
||||
def lstrip(s: str, prefix: str, max: int = -1) -> str:
|
||||
l = len(prefix)
|
||||
c = 0
|
||||
while s.startswith(prefix) and c < max:
|
||||
s = s[l:]
|
||||
c += 1
|
||||
return s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue