Python Forum
idle and characters with decimal value>127
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
idle and characters with decimal value>127
#11
c=127
print("c chr©")
while c<160:
c=c+1
if c % 8==0:
print()
print©
print(chr©,end="")
Reply
#12
c=127
print("c chr©")
while c<160:
c=c+1
if c % 8==0:
print()
print©
print(chr©,end="")
Reply
#13
c=127
print("c  chr(c)")
while c<160:
    c=c+1
    if c % 8==0:
        print()
        print(c)
    print(chr(c),end="")
Reply
#14
In my idle for python 3.8 it shows
======================== RESTART: /home/eric/tmp/foo.py ========================
c  chr(c)

128
€‚ƒ„…†‡
136
ˆ‰Š‹ŒŽ
144
‘’“”•–—
152
˜™š›œžŸ
160
 
>>> 
Reply
#15
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

[email protected]:~# 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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove escape characters / Unicode characters from string DreamingInsanity 5 3,058 May-15-2020, 01:37 PM
Last Post: snippsat
  testing for Decimal w/o importing decimal every time Skaperen 7 1,792 May-06-2019, 10:23 PM
Last Post: Skaperen
  mixed decimal point characters Skaperen 1 949 Mar-10-2019, 05:23 PM
Last Post: stullis
  IDLE not importing pygame (ok outside of IDLE) miner_tom 1 1,513 Sep-14-2018, 07:54 PM
Last Post: Larz60+
  IDLE crash using special characters? reikonaga 6 2,497 Aug-06-2018, 07:37 AM
Last Post: keegan_010
  Python IDLE 3.6.2 on WIn7 vs Pyhton 3 IDLE raspberry djdan_23 5 3,850 Sep-07-2017, 12:51 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020