嗨,我有问题,因为这个函数会创建我想要的数字,但也会生成一个None
. 我应该如何编写此代码以不产生 NONE
def binary (str):
b = []
for x in str:
b.append(format(ord(x), 'b'))
return ((b))
clave = "1001001000010001001000110111111100110000100011001010100000110001110110011111010010011111000011111001000011101011001101000001110010011110010110000000"
c = list(clave)
msg = binary("Lol")
print("".join(msg))
m = list("".join(msg))
print("Now the right")
def OTP(m,c):
for i in range (0,len(m)):
if c[i]== "1" and m[i]== "1":
m.pop(i)
m.insert(i,"0")
elif c[i] == "1" and m[i] == "0":
m.pop(i)
m.insert(i,"1")
return print("".join(m))
msg1 = OTP(m,c)
print(msg1)