摘要: 问题:print "hello" SyntaxError: Missing parenthesesin call to 'print'解决:python3取消了这种用法。使用 print('hello"),这种来输出。python3 语法 和 python2 已经变得有些差别了。python3中,去... 阅读全文
posted @ 2015-10-07 10:10 鲁上客 阅读(1243) 评论(0) 推荐(0) 编辑
摘要: # 帮助文档1、dir函数式可以查看对象的属性:Python命令窗口输入 dir(str) 即可查看str的属性。2.如何查看对象某个属性的帮助文档 ? 如要查看str的split属性,可以用__doc__(双下划线), 使用方法为print(str.split.__doc__) 或者help函... 阅读全文
posted @ 2015-10-07 10:00 鲁上客 阅读(2407) 评论(0) 推荐(0) 编辑
摘要: python实例:backup 备份本文来源于《python简明教程》中的实例1.提出问题: 我想要一个可以为我的所有重要文件创建备份的程序。2. 分析明确问题:我们如何确定该备份哪些文件?备份保存在哪里?我们怎么样存储备份?3. 设计程序列表: 1). 需要备份的文件和目录由一个列表指定。 2)... 阅读全文
posted @ 2015-10-07 09:32 鲁上客 阅读(987) 评论(0) 推荐(0) 编辑
摘要: def printMax(x, y): '''Prints the maximum of two numbers. The two values must be integers.''' x = int(x) # convert to integers, if possible y = in... 阅读全文
posted @ 2015-10-07 06:11 鲁上客 阅读(881) 评论(0) 推荐(0) 编辑