摘要: 因为python3现在还不能直接连接数据库,所有如果想连接,就只能通过以下方法: 在APP中的,__init__.py中,添加以下代码就可以: 阅读全文
posted @ 2017-08-18 09:41 qiao1234 阅读(411) 评论(0) 推荐(0) 编辑
摘要: __str__和__repr__ 如果要把一个类的实例变成 str,就需要实现特殊方法__str__(): class Person(object): def __init__(self, name, gender): self.name = name self.gender = gender de 阅读全文
posted @ 2017-08-10 15:27 qiao1234 阅读(273) 评论(0) 推荐(0) 编辑
摘要: python3+selenium使用浏览器IE的时候,老是报错: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones 阅读全文
posted @ 2017-07-13 16:35 qiao1234 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 同时安装Python2与Python3,安装第三方包,老是报错提示Fatal error in launcher: Unable to create process using '"',那可能是环境变量有冲突了。 解决办法: 阅读全文
posted @ 2017-06-29 11:58 qiao1234 阅读(448) 评论(0) 推荐(0) 编辑
摘要: python2 + selenium + eclipse 中,配置好runserver 127.0.0.1:9000,运行的时候,报错,如图: 原来: import django.core.handlers.wsgi application = django.core.handlers.wsgi.W 阅读全文
posted @ 2017-06-19 15:15 qiao1234 阅读(323) 评论(0) 推荐(0) 编辑
摘要: python2 + selenium + eclipse 中,通过django生产数据库表的时候报错 解决: 1.查看自己电脑中,“开始-->控制面板-->管理工具-->服务-->mysql56-->启动服务”,是否停止了mysql服务。 阅读全文
posted @ 2017-06-19 15:13 qiao1234 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-06-19 15:10 qiao1234 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 普通字符串可以用多种方式编码成Unicode字符串,具体要看你究竟选择了哪种编码: unicodestring = u"Hello world" # 将Unicode转化为普通Python字符串:"encode" utf8string = unicodestring.encode("utf-8") 阅读全文
posted @ 2017-06-19 15:10 qiao1234 阅读(35959) 评论(0) 推荐(1) 编辑
摘要: 一、十八种定位方法 前八种是大家都熟悉的,经常会用到的 1.id定位:find_element_by_id(self, id_) 2.name定位:find_element_by_name(self, name) 3.class定位:find_element_by_class_name(self, 阅读全文
posted @ 2017-06-19 15:09 qiao1234 阅读(266) 评论(0) 推荐(0) 编辑
摘要: /退回上一级表单 driver.switchTo().defaultContent(); 如果上面行不通,访问以下网站: https://www.cnblogs.com/math98/p/11013579.html 如果定位不到元素,报selenium.common.exceptions.NoSuc 阅读全文
posted @ 2017-06-19 15:06 qiao1234 阅读(1895) 评论(1) 推荐(0) 编辑