---
title: "python脚本程序包含中文字符"
author: "xxtianxiaxing"
date: "2014-03-10T14:57:16Z"
tags: []
categories: ["编程语言"]
slug: "python"
draft: false
lastmod: "2014-03-10T14:57:54Z"
id: 2028887
url: "https://xylonwang.iteye.com/blog/2028887"
---

**python脚本程序包含中文字符：**

 

**异常信息：**

SyntaxError: Non-ASCII character '\\xe7' in file ./xylon on line 14, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

 

**解决：将以下三行放在脚本的最顶部。**

#! /usr/bin/python

\# coding=utf-8

\# \_\*_ coding:utf8 \_\*_