-1
這是我的代碼。我是編程新手,所以你可以幫我解決如何正確調換行和列的方法嗎?python - 轉置行和列
def scytale_encrypt(plain_text, key):
chars = [c for c in plain_text if c not in (' ',',','.','?','!',':',';',"'")]
chunks = math.ceil(len(chars)/ float(key))
inters, i, j = [], 1, 1
cipher, k = [], 0
item=[]
while i <= chunks :
inters.append(tuple(chars[j-1:(j + key)-1]))
i += 1
j += key
while k < key:
l = 0
while l < chunks:
if k >= len(inters[l])and plain_text.islower():
cipher.append('z')
elif k >= len(inters[l]):
cipher.append('Z')
else:
cipher.append(inters[l][k])
l += 1
k += 1
print (inters)
return ''.join(cipher);
我的輸入 My inpputed plain text and key
看起來過於複雜,發表您的'plain_text' – RomanPerekhrest
我沒有上傳PIC好心看一看。我編輯了我的帖子 – JEFF