随笔分类 -  python

上一页 1 2

Python问题:SyntaxError: Non-ASCII character '\xe2' in file
摘要:SyntaxError: Non-ASCII character '\xe2' in file意思是说,在文件中存在非ASCII字符; ASCII是8位即一个字符,一共256个字符,随着计算机的发展,现在已经用到2个或者4个字符; 建议在【文件头】追加: 1 2 3 # -*- coding: cp 阅读全文

posted @ 2017-05-24 17:29 sunny_2016 阅读(252) 评论(0) 推荐(0)

sublime python 配置内容
摘要:{"cmd": ["python", "-u", "$file"],"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)","path":"D:/Python27","selector": "source.python"} 阅读全文

posted @ 2017-05-19 09:43 sunny_2016 阅读(110) 评论(0) 推荐(0)

sublime ctrl b突然不能用解决方法
摘要:Sublime Text 2 ?ctrl+b 如果出现运行为空白,按ctrl+`来显示错误,如下所示,转载了一篇解决方案 ? 文章参考:http://eric.themoritzfamily.com/python-encodings-and-unicode.html http://desert3.i 阅读全文

posted @ 2017-05-19 09:41 sunny_2016 阅读(544) 评论(0) 推荐(0)

python在windows系统上创建文件
摘要:正确方法为:open("test1.txt",'wb')或open("test1.txt",'w') 以下是网上的方法创建遇到的问题 使用Python2.7在windows系统中os.mknod调用错误 一直想学习一门脚本语言,用来做一些快速的脚本处理。在同事的强烈推荐下,我选择了Python。最开 阅读全文

posted @ 2017-02-06 17:44 sunny_2016 阅读(1637) 评论(1) 推荐(0)

python批量创建txt文件,以demo.txt内的内容为文件名
摘要:#批量创建txt文件import sys,osa=open("demo.txt")n=0aList=[]for line in a.readlines(): aList.append(str(line.strip('\n')))print aListfor i in aList: os.system 阅读全文

posted @ 2017-02-06 17:33 sunny_2016 阅读(1449) 评论(0) 推荐(0)

python批量修改文件名(以修改图片名为例)
摘要:#coding=utf-8import sys, string, os, shutil #输入目录名和前缀名,重命名后的名称结构类似prefix_0001 def RenameFiles(srcdir, prefix): srcfiles = os.listdir(srcdir) index = 1 阅读全文

posted @ 2017-02-06 17:19 sunny_2016 阅读(2736) 评论(0) 推荐(0)

交互器中python中的帮助使用
摘要:C:\Users\ceshi>pythonPython 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credit 阅读全文

posted @ 2017-02-06 13:19 sunny_2016 阅读(179) 评论(0) 推荐(0)

python文件和目录操作方法大全(含实例)
摘要:# os 模块os.sep 可以取代操作系统特定的路径分隔符。windows下为 '\\'os.name 字符串指示你正在使用的平台。比如对于Windows,它是'nt',而对于Linux/Unix用户,它是 'posix'os.getcwd() 函数得到当前工作目录,即当前Python脚本工作的目 阅读全文

posted @ 2017-02-05 14:05 sunny_2016 阅读(235) 评论(0) 推荐(0)

Python查看帮助---help函数
摘要:查看所有的关键字:help("keywords") 查看所有的modules:help("modules") 单看所有的modules中包含指定字符串的modules: help("modules yourstr") 查看中常见的topics: help("topics") 例如想要查看CALLS主 阅读全文

posted @ 2017-02-05 13:37 sunny_2016 阅读(480) 评论(0) 推荐(0)

Python获取帮助的3种方式(转载)
摘要:我们可以很容易的通过Python解释器获取帮助。如果想知道一个对象(object)更多的信息,那么可以调用help(object)!另外还有一些有用的方法,dir(object)会显示该对象的大部分相关属性名,还有object._ doc _会显示其相对应的文档字符串。下面对其进行逐一介绍。 1、 阅读全文

posted @ 2017-02-05 13:31 sunny_2016 阅读(20981) 评论(1) 推荐(0)

上一页 1 2

导航