L
L
leham12021-11-30 00:09:40
Python
leham1, 2021-11-30 00:09:40

How to print characters in Python?

Hello. Why doesn't the ruble symbol want to be printed? How can I make it print properly?
I have Python 3.8.
Here is the code where the error occurs:

# -*- coding: utf-8 -*-

str1 = "7500 ₽"
print(str1)

Gives an error message:
UnicodeEncodeError: 'charmap' codec can't encode character '\u20bd' in position 5: character maps to <undefined>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andy_U, 2021-11-30
@leham1

Then see the console settings:
Editor->General->Console and change the encoding to UTF-8.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question