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 ...
随机推荐
- 原生态的javascript的n种技巧(我从别人的博客中拷贝过来的,方便以后查阅)
1.原生JavaScript实现字符串长度截取 function cutstr(str, len) { var temp; var icount = 0; var patrn = /[^\x00-\x ...
- 给iOS开发新手送点福利,简述UIImagePickerController的属性和用法
1.+(BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType; // 检查指定源是否在设备上 ...
- linux 下各个4K区块文件大小测试速度对比 机械硬盘性能 64K性价比收益最高
机械硬盘,每个区块取三次数最小值为准,带2G RAM缓存卡 4K3.4 MB/秒 8K7.3 MB/秒 16K9.5 MB/秒 32K16.7 MB/秒 64K44.2 MB/秒 128K67.1 M ...
- Mybatis通过colliection属性递归获取菜单树
1.现有商品分类数据表category结构如下,三个字段都为varchar类型 2.创建商品分类对应的数据Bean /** * */ package com.xdw.dao; import java. ...
- python urlretrieve 下载图片
python 3中urlretrieve方法直接将远程数据下载到本地.为什么不行? 55 import re import urllib.request def getHtml(url): page ...
- (13/24) css进阶:自动处理css3属性前缀
什么是属性前缀 为了浏览器的兼容性,有时候我们必须加入-webkit,-ms,-o,-moz这些前缀.目的就是让我们写的页面在每个浏览器中都可以顺利运行. 例如: transition: width ...
- JavaScript判断浏览器及其版本信息
通过window.navigator来判断: function getBrowserInfo(){ var Info = {}; var str = window.navigator.userAgen ...
- VBA 判断单元格是否为公式,可用于数组
Function ISFORMULA(ByVal rg As Object) As Variant Dim temp As Variant Dim i As Integer, j ...
- WP8.1 控件默认字体颜色 配置文件位置
C:\Program Files (x86)\Windows Phone Kits\8.1\Include\abi\Xaml\Design\generic.xaml 可在App.xaml文件中over ...
- unity 返回子对象组件
Component[] GetComponentsInChildren(Type t, bool includeInactive = false); //includeInactive: 是否查找非激 ...