上一页 1 2 3 4 5 6 7 8 9 ··· 31 下一页
摘要: codecs 模块: 处理文件操作过程中的乱码问题。 f=codecs.open('fxh.txt','r+') #打开文件 打开的模式: r , w , a ,b , r+ , w+ .... 常用的方法: read() 读取文件中内容 write() 写入内容,必须传入字符串 writeline 阅读全文
posted @ 2017-10-27 23:40 xuanhui 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1、计算1--100的和: >>> n=0>>> for x in range(101):... n=x+n...>>> print(n)5050>>> 2、计算1 500内的奇数和: >>> for x in range(501):... if x%2 != 0:... n=x+n...>>> p 阅读全文
posted @ 2017-10-27 00:28 xuanhui 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 一、if ..else: if 条件语句: xxx else: xxx # 条件成立则执行 二、while while 条件语句 xxx #条件为真则执行 三、for for xx in xxx: xxx break 退出当前循环 continue 结束当前循环进入下一轮循环 阅读全文
posted @ 2017-10-25 21:55 xuanhui 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #编码:#py3中只有2种数据类型:str , bytes# str: unicode形式# bytes: 16进制 (更底层) 有utf8,gbk,gb2312 等等类型#s='hi 范'# 编码: str > bytes # sb1 = bytes(s,'utf-8') # sb2 = s.en 阅读全文
posted @ 2017-10-24 22:13 xuanhui 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 一、列表 list 列表的常用方法: append(object) 追加 index(values,[start,stop]) 传入值看是否在列表中,如果在则返回该值的索引,如果不在则报错 insert(index,object) 在特定的索引位置插入值 pop(index) 删除最后面的一个 re 阅读全文
posted @ 2017-10-23 22:59 xuanhui 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 一、整形 1、 eg: 1,2,3,4...... 2、python2.6中 :raw_input 和 input的区别: please input a str:100 100 is <type 'str'> please input a number:100 100 is <type 'int'> 阅读全文
posted @ 2017-10-20 22:52 xuanhui 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1. Python算数运算符 + - * / // % ....2. Python关系运算符 > < == <= >= <> ...3. Python赋值运算符 = 4. Python 逻辑运算符 not and && or || 对与优先级问题,建议自己控制,优先的自己加括号 阅读全文
posted @ 2017-10-19 21:09 xuanhui 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 链接 http://blog.csdn.net/lanchunhui/article/details/49514297 http://blog.csdn.net/chenggong2dm/article/details/9368641 http://blog.csdn.net/u013088062/ 阅读全文
posted @ 2017-10-18 23:35 xuanhui 阅读(156) 评论(0) 推荐(0) 编辑
摘要: pycharm编辑器的基本设置: 点击左上角 File > Settings > Editor 更改解释器:Project:$projectname #选择你的项目 点击Project Interpreter就能更改你的解释器了 设置字体 :console font 默认模板是不能更改的,可以通过点 阅读全文
posted @ 2017-10-17 23:40 xuanhui 阅读(272) 评论(0) 推荐(0) 编辑
摘要: python2.x > print不是个函数 ,无法使用help(print) 查看帮助 python3.x > print()是一个函数,查看帮助如下: >>> help(print)Help on built-in function print in module builtins: print 阅读全文
posted @ 2017-10-16 23:00 xuanhui 阅读(234) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 31 下一页