Python Forum
idle and characters with decimal value>127 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: idle and characters with decimal value>127 (/thread-33986.html)

Pages: 1 2


RE: idle and characters with decimal value>127 - hakelm - Jun-18-2021

c=127
print("c chr©")
while c<160:
c=c+1
if c % 8==0:
print()
print©
print(chr©,end="")


RE: idle and characters with decimal value>127 - hakelm - Jun-18-2021

c=127
print("c chr©")
while c<160:
c=c+1
if c % 8==0:
print()
print©
print(chr©,end="")


RE: idle and characters with decimal value>127 - hakelm - Jun-18-2021

c=127
print("c  chr(c)")
while c<160:
    c=c+1
    if c % 8==0:
        print()
        print(c)
    print(chr(c),end="")



RE: idle and characters with decimal value>127 - Gribouillis - Jun-18-2021

In my idle for python 3.8 it shows
======================== RESTART: /home/eric/tmp/foo.py ========================
c  chr(c)

128
€‚ƒ„…†‡
136
ˆ‰Š‹ŒŽ
144
‘’“”•–—
152
˜™š›œžŸ
160
 
>>> 



RE: idle and characters with decimal value>127 - hakelm - Jun-19-2021

with

c=127
with open('ci.txt', 'w') as f:
    while c<160:
        c=c+1
        f.write(chr(c))
as cf.py and doing

root@nilxx:~# python3 cf.py; hexdump ci.txt
0000000 80c2 81c2 82c2 83c2 84c2 85c2 86c2 87c2
0000010 88c2 89c2 8ac2 8bc2 8cc2 8dc2 8ec2 8fc2
0000020 90c2 91c2 92c2 93c2 94c2 95c2 96c2 97c2
0000030 98c2 99c2 9ac2 9bc2 9cc2 9dc2 9ec2 9fc2
0000040 a0c2
0000042

you can see that python produces UTF-characters and what you see on your screen depends on your OS and what "code page" is active.
H