python操作的处理
2016-07-20 09:09
295 查看
python下包含中文路径事出错:
在源代码第一行添加一下代码
# -*- coding: UTF-8 -*-
或者
#coding=utf-8
或者也可以这么改:
inpath = 'D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt'
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)
正则表达式的捕获原则:
例如:xxx(xxxx)(?:xxxx),你用这个正则表达式去匹配如果被匹配上可以得到()中被匹配文档的值, (?:)则不会得到。
在源代码第一行添加一下代码
# -*- coding: UTF-8 -*-
或者
#coding=utf-8
或者也可以这么改:
inpath = 'D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt'
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)
正则表达式的捕获原则:
例如:xxx(xxxx)(?:xxxx),你用这个正则表达式去匹配如果被匹配上可以得到()中被匹配文档的值, (?:)则不会得到。
相关文章推荐
- python学习——asyncio
- python学习——协程
- python学习——异步IO
- python学习——使用模板
- python介绍
- python学习——使用WEB框架
- python学习——WSGI接口
- python学习——HTML简介
- Learning Python 010 函数 1
- Learning Python 010 函数 1
- windows下,python的各类包的安装(cython, numpy, xlrd, xlwt)
- Learning Python 009 dict(字典)和 set
- Learning Python 009 dict(字典)和 set
- Python下安装Numpy,Scipy,Matlotlib
- 文章标题
- 翻转二叉树(leetcode-226)
- python中print的不换行即时输出的快速解决方法
- Python 字符串 String 内建函数大全(1)
- Python 字符串 String 内建函数大全(2)
- 使用python脚本将XML 电子表格转变为Excel