glob模块中有一个叫glob的方法可以获取某个目录下的文件. import glob temp=glob.glob("E:\\Temp\\*.txt") print(temp) 则返回E盘下Temp文件夹下的所有txt文件的路径. 注意返回的是一个列表. 另外参数可以为一个相对路径,则以当前工作目录为准.…
Python第十一天    异常处理  glob模块和shlex模块    打开外部程序和subprocess模块  subprocess类  Pipe管道  operator模块   sorted函数    os模块   hashlib模块  platform模块  csv模块 目录 Pycharm使用技巧(转载) Python第一天  安装  shell  文件 Python第二天  变量  运算符与表达式  input()与raw_input()区别  字符编码  python转义符  字…
Python学习系列(六)(模块) Python学习系列(五)(文件操作及其字典) 一,模块的基本介绍 1,import引入其他标准模块 标准库:Python标准安装包里的模块. 引入模块的几种方式: i)引入模块:import   moduleName ii)引入模块下的函数:from moduleName import function1,function2,…… iii)引入模块下的所有函数:from moduleName import * 使用模块里的函数的方法: moduleName.…
在开发过程中,字符串和python数据类型进行转换,下面比较python学习第四十八天json模块与pickle模块差异. json 的优点和缺点 优点  跨语言,体积小 缺点 只能支持 int str list tuple dict pickle 的优点和缺点 优点 专门为python设计,支持python所有的数据类型 缺点 只能python使用,存储数据占空间大 文章来自 www.96net.com.cn…
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…
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…
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…
今天学习了Python中有关正则表达式的知识.关于正则表达式的语法,不作过多解释,网上有许多学习的资料.这里主要介绍Python中常用的正则表达式处理函数. re.match re.match 尝试从字符串的开始匹配一个模式,如:下面的例子匹配第一个单词. import re text ="JGood is a handsome boy, he is cool, clever, and so on..." m = re.match(r"(\w+)\s", text)…
基础知识 1. 定义 模块:用来从逻辑上组织python代码(变量,函数,类,逻辑----实现一个功能),本质就是.py结尾的python文件(文件名:test.py,对应的模块就是test) 包:用来从逻辑上组织模块的,本质就是一个目录(必须带有一个__init__.py文件) 2. 导入方法 module_cc文件里有很多函数&变量: import module1_name import module1_name,module2_name from module_cc import *  …
Python的标准安装包括一组模块,称为标准库.这里介绍模块的工作方式,学习如何使用它们. 一. 模块 1.1 用import从外部模块获取函数并为自己的程序所用: >>> from math import sqrt >>> import math 1.2 编写自己的模块 任何python程序都可以作为模块导入.程序保存的位置很重要.假设我们所写的程序叫hello.py被保存在c:/python目录下,可以执行以下的代码,告诉解释器在哪里寻找hello.py模块: #h…