Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
288 views
Welcome To Ask or Share your Answers For Others

1 Answer

No matter which editor you use or which OS you use, this will always work. simply using sys.stdout.buffer.write() which is one of the best practices.

import sys 

s2 = '∞?????????????????????'
s3 = 'α?áà????éèêíì??óò???úùü?'
s4 = '????│▏┃┆┇┊?┋???????????┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛'

x = s2.encode('utf8')
y = s3.encode('utf8')
z = s4.encode('utf8')

# you can use loops if you want, python is fun!
sys.stdout.buffer.write(x)
print("")
sys.stdout.buffer.write(y)
print("")
sys.stdout.buffer.write(z)
print("")

output:

∞?????????????????????
α?áà????éèêíì??óò???úùü?
????│▏┃┆┇┊?┋???????????┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...