摘要: 1 print('"I\'m OK"') 2 print("I'm OK") 3 print('"I"\'m \"OK"') 1 "I'm OK" 2 I'm OK 3 "I"'m "OK" \ \表示转义字符 \\\表示转义并显示\ \\指转义后\ \n指换行 \t指制表符,指对齐 判断条件 1 阅读全文
posted @ 2020-05-29 17:31 mohan-98 阅读(204) 评论(0) 推荐(0)
摘要: 异常的层次结构: BaseException 【所有异常的基类】 +-- SystemExit 【解释器请求退出】 +-- KeyboardInterrupt 【用户中断执行(通常是输入^C)】 +-- GeneratorExit 【生成器(generator)发生异常来通知退出】 +-- Exce 阅读全文
posted @ 2020-04-14 17:10 mohan-98 阅读(375) 评论(0) 推荐(0)
摘要: 缩进导致的报错 报: File "test.py", line 11 print ("False") ^IndentationError: unindent does not match any outer indentation level NameError 命名错误 原因是: name 'a' 阅读全文
posted @ 2020-04-14 17:09 mohan-98 阅读(347) 评论(0) 推荐(0)
摘要: 谷歌地址及对应的驱动: https://blog.csdn.net/whale_and/article/details/82455126 火狐地址及对应驱动: https://blog.csdn.net/qq_29535381/article/details/85729987 https://www 阅读全文
posted @ 2020-04-14 16:05 mohan-98 阅读(887) 评论(0) 推荐(0)
摘要: 一、字典的键是唯一的 键:简单对象,例【字符串、整数、浮点数、bool值】 list不能作为键,但可以作为值。 例: score = { '萧峰' : 95, '段誉' : 97, '虚竹' : 89 } python字典中的键/值对没有顺序,无法用索引访问字典的某一项,而要用键来访问。 print 阅读全文
posted @ 2018-06-01 16:01 mohan-98 阅读(175) 评论(0) 推荐(0)
摘要: 意思是,在java.py这个文件,你用了不是十进制能够表示的字符,没办法转为int值。 二、打开一个文件 f = file('non-exist.txt') print 'File opened' f.close() 若文件因某种原因没有出现在应该出现的·文件夹里,程序就会报错 程序在出错处中断,后 阅读全文
posted @ 2018-06-01 14:30 mohan-98 阅读(119) 评论(0) 推荐(0)
摘要: 字符串分割 例:sentenc = "I am an Englist sentenc" sentence.split() split()把字符串按照空格进行分割,所以得到的结果是 ['I','am','an','Englist','sentenc']字符串的空格不存在 除空格外也可按照【\n】、制表 阅读全文
posted @ 2018-05-29 18:33 mohan-98 阅读(258) 评论(0) 推荐(0)
摘要: 电脑随机出现1~100之间一个数,由你输入一个数字比较两个数字的大小 输入大于的时候出现“too big” 输入小于的时候出现“too small” 相等的时候出现“bingo” 当两个数相等的时候返回True 两个数不相等的时候返回False if elif else 运行结果 if嵌套 运行结果 阅读全文
posted @ 2018-05-22 18:05 mohan-98 阅读(138) 评论(0) 推荐(0)
摘要: 进入python官网 http://www.python.org/download/ 下载python2.7.x 版 下载安装后配置环境变量 在path中——>>>把安装路径复制粘贴,点击确定。 查看python是否配置好 打开命令窗口(win + r —>>> 输入cmd) 输入python 按回 阅读全文
posted @ 2018-05-22 14:18 mohan-98 阅读(139) 评论(0) 推荐(0)
摘要: #获取全屏图片,并截取验证码图片的位置driver.get_screenshot_as_file('a.png')location = driver.find_element_by_id('imgValidateCode').locationsize = driver.find_element_by 阅读全文
posted @ 2018-05-21 17:24 mohan-98 阅读(250) 评论(0) 推荐(0)