×
解除綁定,重新設定系統帳號的密碼
您的系統帳號 ID:
您的系統帳號:
您的帳號暱稱:
設定新密碼:
設定新密碼:
×
請輸入要加入的「課程代碼」
請向開設課程的使用者索取「課程代碼」
分類題庫
解題動態
排行榜
討論區
競賽區
登入
註冊
發表新討論
#17190: 看不懂錯誤的模式--python
abcd9597938
(unknown)
學校 : 不指定學校
編號 : 94775
×
傳送站內訊息
傳給:
主題:
內容:
來源 : [223.136.58.170]
最後登入時間 :
2019-03-26 14:38:08
a009.
解碼器
--
ACM 458
| From: [159.117.69.235] | 發表日期 : 2019-03-24 13:55
import sys
for c in sys.stdin:
s=str(c.strip())
for single in s:
mystr=chr(ord(single)-7)
print(mystr,end="")
這段如果打在VScode裡面輸入完亂碼之後按下enter會再度進到sys.stdin,直到按下Cirtl Z,他就會print出解碼並且結束
如果打在測試則會發現兩行明碼連在一起
我嘗試在vscode裡面打成:
import sys
for c in sys.stdin:
s=str(c.strip())
for single in s:
mystr=chr(ord(single)-7)
print(mystr,end="\n") #因為本來默認就是如此
會print出一個字換行一次的明碼
--------------------------------------
for c in sys.stdin:
s=str(c.strip())
for single in s:
print("here")
mystr=chr(ord(single)-7)
print(mystr,end="")
輸入完亂碼結果:
here
*here
Ihere
Bhere
Mhere
here
ihere
... #又有印了,但是是明碼+"here"+"\n"
請教大神為何會如此呢?
ZeroJudge Forum