Answer the question
In order to leave comments, you need to log in
Encoding in Pycharm?
Hello, Pycharm throws an error when using Cyrillic.
The code:
print("Вычисление НОД")
first_num = int(input("Введите первое число: "))
second_num = int(input("Введите второе число: "))
def NOD(x, y):
while y != 0:
x, y = y, x % y
return x
print("НОД =", NOD(first_num, second_num))
File "/Users/danielkopetskiy/PycharmProjects/PROGRAM_SPB/NOD.py", line 2
SyntaxError: Non-ASCII character '\xd0' in file /Users/danielkopetskiy/PycharmProjects/PROGRAM_SPB/NOD.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Вычисление НОД
Введите первое число: 4
Введите второе число: 5
('\xd0\x9d\xd0\x9e\xd0\x94 =', 1)
Answer the question
In order to leave comments, you need to log in
At the very beginning of the file
# -*- coding: utf-8 -*-
# !/usr/bin/env python
It's not PyCharm, but the Python interpreter. Switch to Python 3 already, utf-8 is assumed by default.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question