python十进制转为二进制,且高位补0,不用内置函数。

n=int(input())
a=[]
while n!=0:
a.insert(0,n%2)
n//=2
for i in a:
i=str
print("{:08b}".i,end="")

https://blog.csdn.net/daydayjump/article/details/80705131