【发布时间】:2015-12-09 14:16:18
【问题描述】:
我的代码没有在 Python 中显示。怎么了?
offset_factor = math.floor(number[0]+number[1]+number[2]+number[3]+number[4]+number[5]+number[6]+number[7])
total = offset_factor
total = total / 8 - 32
total = round(total)
print("This is your offset factor: ")
print(total)
string = ''.join(str(e) for e in text_read)
nospace = string.replace(" ", "")
print(nospace)
for b in (nospace):
string = ""
ASCII = ord(b)
result = ASCII + total
if result > 126:
result - 96
else:
result = result
result_ascii = chr(result)
string += result_ascii
for b in nospace:
string = ""
ASCII = ord(b)
result = ASCII + total
if result > 126:
result - 96
else:
result = result
result_ascii = chr(result)
string += result_ascii
print(result_ascii)
这段代码不显示,我不知道为什么不显示,它只加密了八个字符,但我不知道如何使它加密所有字符。
【问题讨论】:
-
result - 96不能像现在这样生活,它应该被分配一个名字,如下面的行 -
嗯,你期待什么?我在您的代码中看不到
print。应该显示什么? (不是说nospace是空的,循环不运行) -
搞定了,看看我上面的代码
-
好的,谢谢。我现在正在尝试运行它...
number和math和text_read的值是多少? -
number的值为number = [],text_read为用户输入的文件
标签: python python-3.x encryption ascii