上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 一. r 正则对象 1. 正则匹配总写一个r 是什么意思 r 表示raw的简写及raw string 意思是原生字符,也就是这个字符串中间的特殊字符不用转义。比如你要表示‘\n’ ,可以这样: r'\n'.。但是如果你不用原生字符,而是用字符串,你得这样:‘\\n’ 2. re.compile(pa 阅读全文
posted @ 2017-11-16 00:33 刘振川的博客 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 一. python 中常用的正则表达式 二. 正则表达式的网站,可以进行在线正则匹配 https://regex101.com/ 1. 使用方法及正则介绍 1》 ‘.’ 匹配任意除换行符外(\n)的任意字符 ‘*’ 匹配前一个字符0次或任意多次 2》\b 匹配数字0-9 3》\D 匹配非数字 [^\ 阅读全文
posted @ 2017-11-16 00:09 刘振川的博客 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 一. 文件和json 之间的转换 1. json.dump() #/usr/bin/python #coding=utf-8 #@Time :2017/11/13 0:12 #@Auther :liuzhenchuan #@File :json -下.py ##文件相关的 #load 肯定是从文件中 阅读全文
posted @ 2017-11-13 09:06 刘振川的博客 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 一. 文件json 的使用 json简介:json 全名 javaScripts object Notation,是一种轻量级的数据交换格式,json最广泛的应用是作为AIAX中web 服务器和客户端的通讯的数据格式,现在也常用于httpd请求中,所以对json 的各种学习,是自然而然的事情。下面是 阅读全文
posted @ 2017-11-13 09:05 刘振川的博客 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 一.sys 模块 sys 模块主要功能是获取参数 [root@www pythonscripts]# cat 2.py #!/usr/bin/python #coding=utf-8 import os import sys if __name__ == '__main__': print ('sy 阅读全文
posted @ 2017-11-11 19:52 刘振川的博客 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 一. commands 模块 1.commands 模块只使用与linxu 的shell 模式下 在我们平时码字时,经常需要调用系统脚本或者系统命令来解决很多问题,接下来,我们就介绍给大家一个很好用的模块commands,可以通过python 调用系统命令,调用系统命令commands 模块提供了三 阅读全文
posted @ 2017-11-11 19:51 刘振川的博客 阅读(472) 评论(0) 推荐(0) 编辑
摘要: #/usr/bin/python #coding=utf8 #@Time :2017/11/11 3:15 #@Auther :liuzhenchuan #@File :os 模块.py import os #1. 通过os 获取操作系统类型,os.name = windows是 nt类型,os.n 阅读全文
posted @ 2017-11-11 19:50 刘振川的博客 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 一. logging 的使用 日志是我们排查问题的关键利器,写好日志记录,当我们发生问题时,可以快速定位代码范围进行修改。python有给我们开发者提供好的日志模块,下面我们就来介绍一下logging模块: import logging #从上往下,日志级别逐渐升高 logging.debug('t 阅读全文
posted @ 2017-11-11 19:47 刘振川的博客 阅读(307) 评论(0) 推荐(0) 编辑
摘要: #/usr/bin/python #coding=utf-8 #@Time :2017/11/9 8:55 #@Auther :liuzhenchuan #@File :时间格式的相互转换.py import time # datatime 是一个时间对象 print '##'*5 + 'datet 阅读全文
posted @ 2017-11-09 10:25 刘振川的博客 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 一 datatime 的使用 object timedeta tzinfo time data datatime time: 在python文档里,time是归类在generk operating system services 中,换句话说,它提供的功能是更加接近于操作系统层面。 python 开 阅读全文
posted @ 2017-11-09 10:24 刘振川的博客 阅读(539) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页