Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My first step in Python

Tags:

python

I'm trying to start learning Python, but I became confused from the first step. I'm getting started with Hello, World, but when I try to run the script, I get:

Syntax Error: Non-UTF-8 code starting with '\xe9' in file C:\Documents and Settings\Home\workspace\Yassine frist stared\src\firstModule.py on line 5 but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details.

like image 432
user1929872 Avatar asked Dec 26 '12 13:12

user1929872


People also ask

How do I get Started with Python?

Step 1. Create and run your first Python project Step 1. Create and run your first Python project You have installed Python itself. If you're using macOS or Linux, your computer already has Python installed. You can get Python from python.org.

How to write Python code on geeksforgeeks?

Step 1: Open an editor of your choice to write the Python code. Here we will simply use Notepad but it is completely up to you what you prefer. print("Welcome to GeeksForGeeks!") Step 3: Now that we have completed the code save it as gfg.py (‘gfg’ is just a name that we gave to the python file)

How to get started with Python for machine learning?

The best way to get started using Python for machine learning is to complete a project. It will force you to install and start the Python interpreter (at the very least). It will given you a bird’s eye view of how to step through a small project.

What is the best way to learn Python?

The syntax of the Python language can be intuitive if you are new to it. Just like other languages, focus on function calls (e.g. function ()) and assignments (e.g. a = “b” ). This will get you most of the way. You are a developer, you know how to pick up the basics of a language real fast.


2 Answers

add to the first line is

# -*- coding: utf-8 -*-
like image 178
user1928850 Avatar answered Sep 30 '22 01:09

user1928850


Put as the first line of your program this:

# coding: utf-8

See also Correct way to define Python source code encoding

like image 25
warvariuc Avatar answered Sep 29 '22 23:09

warvariuc