Python学习day16-模块基础】的更多相关文章

模块就是程序 编写以下简单代码 print('hello python') 并将py文件保存在c盘的python(假设新建)文件下,通过pycharm的Terminal 或者windom命令窗口调出python解释器并输入以下代码 import sys sys.path.append('c:/python') import hello 将看到以下输出结果 hello python 用py内置函数dir演示此行代码是如何被打印的. 可以看到初次调用python解释器时会显示一个列表.当导入内置模块…
模块(总) 对于range py2,与py3的区别: py2:range() 在内存中立即把所有的值都创建,xrange() 不会再内存中立即创建,而是在循环时边环边创建. py3:range() 不会再内存中立即创建,而是在循环时边环边创建. 对于包的定义py2与py3的区别: 包内py2内文件夹中必须有_ _ init _ _ .py py3中不需要 建议所有的包内全部加上_ _ init _ _ .py文件 sys.exit() 退出程序 函数书写时一定要写注释 复杂代码写注释 构造字典和…
<!doctype html>day16 - 博客 figure:last-child { margin-bottom: 0.5rem; } #write ol, #write ul { position: relative; } img { max-width: 100%; vertical-align: middle; } button, input, select, textarea { color: inherit; font: inherit; } input[type="…
Python学习笔记之基础篇(-)初识python Python的理念:崇尚优美.清晰.简单,是一个优秀并广泛使用的语言. python的历史: 1989年,为了打发圣诞节假期,作者Guido开始写Python语言的编译器.Python这个名字,来自Guido所挚爱的电视剧Monty Python’s Flying Circus.然后这个新语言就叫python,能符合他的理想:创造一种C和shell之间,功能全面,易学易用,可拓展的语言. 1991年,第一个Python编译器诞生.它是用C语言实…
数字 int 主要是用于计算的,常用的方法有一种 #既十进制数值用二进制表示时,最少使用的位数i = 3#3的ASCII为:0000 0011,即两位 s = i.bit_length() print(s) 布尔值 bool  True/False while True: 等价于: while 1:   ###较简便 while 1: print('all trule') 字符串 str 字符串的索引与切片 索引:索引既下标,字符串元素从第一个开始,初始索引为0.以此类推. s = 'sdfjs…
1. Python学习--Selenium模块介绍(1) 2.Python学习--Selenium模块学习(2) 其他: 1. Python学习--打码平台…
Selenium的基本操作 获取浏览器驱动寻找方式 1. 通过手动指定浏览器驱动路径2. 通过 `$PATH`环境变量找寻浏览器驱动 可参考Python学习--Selenium模块简单介绍(1) 控制浏览器访问URL browser.get(https://www.baidu.com/)   find系列函数定位元素 - `find_element_by_xxx` 返回第一个符合条件 `WebElement` - `find_elements_by_xxx` 返回符合条件所有元素包含了`WebE…
time     [时间模块] import time # print(help(time)) # time模块的帮助 print(time.time()) # 时间戳 print(time.clock()) # 计算CPU执行的时间 print(time.ctime()) # 默认当前时间 Sun Dec 10 22:07:16 2017 print(time.ctime(1512914742)) # 秒转换为时间 Sun Dec 10 22:05:42 2017 print(time.mkt…
<!doctype html>day12博客 figure:last-child { margin-bottom: 0.5rem; } #write ol, #write ul { position: relative; } img { max-width: 100%; vertical-align: middle; } button, input, select, textarea { color: inherit; font: inherit; } input[type="che…
figure:last-child { margin-bottom: 0.5rem; } #write ol, #write ul { position: relative; } img { max-width: 100%; vertical-align: middle; } button, input, select, textarea { color: inherit; font: inherit; } input[type="checkbox"], input[type=&quo…