how can I print "\n" as a normal newLine "\n"
example:
str = "lorem\\nipsum"
the output should be:
lorem
ipsum
not : lorem\\nipsum
I tried :
print(str[6:])
and more stuff but nothing work
#THE IDEA IS TO GET RAID OF ONLY ONE BACKSLASH TO PRINT IT AS NEWLINE CHARACTER AS SHOULD
ord("\x1c")
>>28
mystr = "\\x1c"
ord(mystr[1:])
File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 3 found```
## here's the actual code ##
import string
lower = list(string.ascii_lowercase) lower_dec = []
upper = list(string.ascii_uppercase) upper_dec = []
nums = list(map(str,range(0,10))) nums_dec =[]
def E(key,p):
cipherList = []
cipherText = []
for row in range(len(key)):
c = 0
for i in range(len(key[row])):
c+= (ord(p[i])*key[row][i])%26
cipherList.append(repr(chr(c)))
for char in cipherList:
cipherText.append(char.replace("'",''))
return cipherText
key = [[2,3,5],[11,4,7],[20,12,12]] p = ['p','a','y']
print(E(key,p))
#that prints ['\x1c', '1', '.']