#μνΈν νλ λ°©λ²
#ord() κΈμμκ³ μ μ«μμλ €μ€ , chr() μ«μμλ§λκΈμμλ €μ€
inFp, outFp = None, None
inStr, outStr = "", ""
i=0
secu=0
secuYN = input("1.μνΈν 2. μνΈ ν΄μ μ€ μ ν >> ")
inFname = input("μ
λ ₯ νμΌλͺ
μ μ
λ ₯νμΈμ :")
outFname = input("μΆλ ₯ νμΌλͺ
μ μ
λ ₯νμΈμ :")
#1λ² μ νμ μνΈν, 2λ² μ νμ 볡νΈν
if secuYN == "1" :
secu = 100
elif secuYN == "2" :
secu = -100
inFp = open(inFname, 'r', encoding = 'utf-8')
outFp = open(outFname, 'w', encoding = 'utf-8')
while True :
inStr = inFp.readline() #νμΌ λ°κΈ°
if not inStr : #νμΌμ΄ μμΌλ©΄ / λμ΄λ©΄ μ’
λ£
break
outStr = ""
for i in range(0,len(inStr)): #λ°μμ¨νμΌκΈμκΈΈμ΄λ§νΌ
ch=inStr[i] #κΈμ νλνλ ch κ°μ λμ
chNum = ord(ch) #κΈμμ κ³ μ μ«μ chNumμ λμ
chNum = chNum + secu #chNum + 100 or -100 μ ν΅ν΄ μ/볡νΈν μ§ν
ch2 = chr(chNum) #chNumμ μ«μλ₯Ό κΈμλ‘ λ³ν
outStr = outStr + ch2 #λ³νν κΈμλ₯Ό outStrμ λμ
outFp.write(outStr)
outFp.close()
inFp.close()
print("%s ----> %s λ³ν μλ£ " % (inFname, outFname))