07 2015 档案
摘要:来源http://my.oschina.net/u/999436/blog/113317我尝试着找找python3.3.0的change log。里面并没有找到urllib的修改记录。然而这一修改记录却在python3.0的change log中。原文是这样写的:a newurllibpackage...
阅读全文
摘要:>>> import string>>> string.ascii_letters'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'>>> string.ascii_lowercase'abcdefghijklmnopqrstuvwxyz'>...
阅读全文
摘要:官方https://docs.python.org/3.4/library/string.html#string.Formatter6.1.string— Common string operationsSource code:Lib/string.pySee alsoText Sequence T...
阅读全文
摘要:运行后一堆空白行>>> fname=input('Enter filename:')Enter filename:hongding>>> try: fobj=open(fname,'r')except(IOError,e): print('***file open error:',e)e...
阅读全文
摘要:>>> import os>>> ls = os.linesep>>> # get filename>>> while True: fname = input('Enter file name: ') if os.path.exists(fname): print("***...
阅读全文
摘要:来源 http://www.cppblog.com/snowhill/articles/200826.htmlOS相关import os可以用help(os); dir(os)查看os.sep 可以取代操作系统特定的路径分割符。os.name字符串指示你正在使用的平台。比如对于Windows,它是'...
阅读全文
摘要:都自己写的,参考。>>> te=input()3sdjflka
阅读全文
摘要:输入一个数判断正负数或0这些是自己写的x=input(也可以什么都没有)自己写过的错误的代码,错误的几种原因:1.字符串和数字无法比大小2.开始定义x=0,后面没有x=input(),所以怎么运行结果都是0
阅读全文
摘要:>>> import os>>> os.system("python D:\qwe.py")1必须是os 别的都不行
阅读全文
摘要:>>> import sys>>> sys.stdout.write('Hello World!\n')Hello World!13>>> sys.platform'win32'>>> sys.version'3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:4...
阅读全文
摘要:为什么运行结果带小括号?foo='abc'带小括号是因为用元组输出,你看foo[1]
阅读全文
摘要:print(foo[不能是空,不能是字母如a或‘a’,可以是0,1,2])去了print,foo[i或数字]输出'a''b''c'(带引号)foo='abc'
阅读全文
摘要:what+'空格'*4,结果是后面四个空格>>> who='k'>>> what='Ni!'>>> print('we are hte %s who say %s'%(who,((what+' ')*4)))we are hte k who say Ni! Ni! Ni! Ni! >>> print...
阅读全文
摘要:这个星期开始学习Python了,因为看的书都是基于Python2.x,而且我安装的是Python3.1,所以书上写的地方好多都不适用于Python3.1,特意在Google上search了一下3.x和2.x的区别。特此在自己的空间中记录一下,以备以后查找方便,也可以分享给想学习Python的frie...
阅读全文
摘要:print语句默认每行添加一个换行符item是列表当item是元组时,本题运行结果是一样的>>> for item in ['e','n','h','c']: print(item) enhc>>> print(item,end=)SyntaxError: invalid syntax>...
阅读全文
摘要:先输出到2,后输出到3c=0赋值过了 再写程序还得写c=0 不晓为什么
阅读全文
摘要:x=5是全局变量,f(x)的x是本地绑定,无论f(几)都不影响最后x永远是5
阅读全文

浙公网安备 33010602011771号