SyntaxError: Non-ASCII character '\xe5' in file D:/pcode/xx.py on line 21, but no encoding declared
from selenium import webdriver
from datetime import *
import time starttime = datetime.now()
print ("start time:%s" %starttime)
dr = webdriver.Firefox() url = "http://www.sohu.com"
print('now access %s' %url) dr.get(url)
#time.sleep(3) endtime = datetime.now()
print ("end time:%s"%endtime) print("u共花费毫秒:",endtime-starttime).microseconds dr.quit()
报错:SyntaxError: Non-ASCII character '\xe5' in file D:/pcode/xx.py on line 21, but no encoding declared
修改后成功代码:
#coding=utf-8
from selenium import webdriver
from datetime import *
import time starttime = datetime.now()
print ("start time:%s" %starttime)
dr = webdriver.Firefox() url = "http://www.sohu.com"
print('now access %s' %url) dr.get(url)
#time.sleep(3) endtime = datetime.now()
print ("end time:%s"%endtime) info = u'共花费时间:(秒)'
print(info.encode('utf-8')+str((endtime-starttime).seconds)) dr.quit()
SyntaxError: Non-ASCII character '\xe5' in file D:/pcode/xx.py on line 21, but no encoding declared的更多相关文章
- Python报错:SyntaxError: Non-ASCII character '\xe5' in file 1.py on line 6, but no encoding declared...
本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=686 具体报错内容: File "1.py", line 6 SyntaxError: Non- ...
- [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。
想在python代码中输出汉字.但是老是出现SyntaxError: Non-ASCII character '\xe4' in file test.py on line , but no encod ...
- SyntaxError: Non-ASCII character '\xe4' in file t.py on line 3, but no encoding declared
问题 报错代码 #!/usr/bin/python s = "你好" print s 执行报错: File "t.py", line 3 SyntaxError ...
- 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。
[已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no enc ...
- SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for
用charles抓包时, 对抓到的html,放到pycharm中解析, 结果报错: SyntaxError: Non-UTF-8 code starting with '\xe5' in file * ...
- Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared
使用网上某个python程序.编译时报错: File "xxx.py", line 8 SyntaxError: Non-ASCII character '\xe8 ...
- SyntaxError: Non-UTF-8 code starting with '\xbb' in file D:\流畅学python\ex32.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
1. 报错如下: SyntaxError: Non-UTF-8 code starting with '\xd3' in file D:\流畅学python\ex34.py on line 4, bu ...
- SyntaxError: Non-ASCII character '\xe5' in file index.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
python入门,hhh 在慕课网上学习python入门,编写汉诺塔的递归调用时,代码正确.但是加上注释后编译不通过 报如下错误: SyntaxError: Non-ASCII character , ...
- SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
错误信息: SyntaxError: Non-ASCII character , but no encoding declared; see http://python.org/dev/peps/pe ...
随机推荐
- Mybatis 测试延迟加载
在学习mybatis的延迟加载时,对 lazyLoadingEnabled 和 aggressiveLazyLoading 的区别并不理解,特别是对查询的条件不同时,执行的查询语句也不一样,所以还是测 ...
- 【C++11新特性】 auto关键字
原文链接: http://blog.csdn.net/xiejingfa/article/details/50469045 熟悉脚本语言的人都知道,很多脚本语言都引入了“类型自动推断”技术:比如pyt ...
- BTree,B-Tree,B+Tree,B*Tree的数据结构
B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: 如: B ...
- win10 停留在启动画面
这是由于部分电脑的主板不支持快速启动造成的,所以把快速启动功能关闭掉即可.具体操作步骤如下:控制面板--硬件和声音--电源选项--选择电源按钮的功能--选择“更改当前不可用的设置”,然后把“启用快速启 ...
- html 更新
HTML介绍 Web服务本质 import socket sk = socket.socket() sk.bind(("127.0.0.1", 8080)) sk.listen(5 ...
- nms
nms函数是保留选框中得分最高的那一个 Python代码如下 def nms(boxes, threshold, method): """ boxes: [x1, y1, ...
- JAVA Spring 事物 ( 已转账为例 ) 基于 AOP 注解
<一> 配置为文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&qu ...
- HTML5 Canvas ( 填充图形的绘制 ) closePath, fillStyle, fill
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- leetcode349
public class Solution { public int[] Intersection(int[] nums1, int[] nums2) { var list1 = nums1.ToLi ...
- vi和vim的三种模式
1.一般模式 用vi 或vim 命令 ——>一般模式 2. 插入模式 i,o,a,r 及其各自大写 ——>插入模式 一般用 i 3.命令行模式 用命令来完成 读取,存盘,替换,离开vim ...