WebLinuxStudy

导航

 

2019年12月11日

摘要: PHP中isset()方法来检查数组元素是否存在,在Python中无对应函数,在Python中一般可以通过异常来处理数组元素不存在的情况,而无须事先检查 Python的编程理念是“包容错误”而不是“严格检查”。举例如下: 代码如下:dict = {}try: dict['abc']['adv'] p 阅读全文
posted @ 2019-12-11 19:46 WebLinuxStudy 阅读(1853) 评论(0) 推荐(0)
 
摘要: 例:#生成一个字典d = {'title':'abc','age':18} if 'title' in d.keys(): print('存在')else: print('不存在') if 'title' not in d.keys(): print('不存在')else: print('存在') 阅读全文
posted @ 2019-12-11 19:38 WebLinuxStudy 阅读(11591) 评论(0) 推荐(0)
 

2019年12月9日

摘要: 获取 redis 中所有的 key 可用使用 *。 redis 127.0.0.1:6379> KEYS * Redis Flushall 命令用于清空整个 Redis 服务器的数据(删除所有数据库的所有 key )。 语法 redis Flushall 命令基本语法如下: 阅读全文
posted @ 2019-12-09 22:46 WebLinuxStudy 阅读(5695) 评论(0) 推荐(0)
 
摘要: 这篇文章主要介绍redis的使用。 简单介绍下redis,一个高性能key-value的存储系统,支持存储的类型有string、list、set、zset和hash。在处理大规模数据读写的场景下运用比较多。 1.连接Redis数据库: 1)直接连接 2)连接池连接 连接池的原理是, 通过预先创建多个 阅读全文
posted @ 2019-12-09 22:43 WebLinuxStudy 阅读(506) 评论(0) 推荐(0)
 
摘要: 本文是转载自:https://www.cnblogs.com/jylee/p/9844965.html 一、下载: 下载地址: https://github.com/MicrosoftArchive/redis/releases 根据系统下载的版本:以(64位为例) 下载后一般解压到根目录下:如(E 阅读全文
posted @ 2019-12-09 22:40 WebLinuxStudy 阅读(464) 评论(0) 推荐(0)
 

2019年12月6日

摘要: RewriteEngine On# 将404页面跳转到 http://abc.com/ ErrorDocument 404 http://abc.com/# 将 不是abc.com 永久跳转到 http://abc.comrewriteCond %{http_host} !^abc.com [NC] 阅读全文
posted @ 2019-12-06 20:26 WebLinuxStudy 阅读(164) 评论(0) 推荐(0)
 

2019年12月5日

摘要: os.access(file, mode)判断文件的访问权限file为文件mode为操作模式,有这么几种:os.F_OK: 检查文件是否存在;os.R_OK: 检查文件是否可读;os.W_OK: 检查文件是否可以写入;os.X_OK: 检查文件是否可以执行; 阅读全文
posted @ 2019-12-05 21:49 WebLinuxStudy 阅读(1297) 评论(0) 推荐(0)
 
摘要: 1.os.path.exists()既可以判断文件是否存在,又可以判断文件夹是否存在 2.os.path.isfile()判断文件是否存在 3.os.path.isdir()判断文件夹是否存在 阅读全文
posted @ 2019-12-05 21:48 WebLinuxStudy 阅读(2502) 评论(0) 推荐(0)
 

2019年12月4日

摘要: 调用pymysql.escape_string('向数据库插入的数据') 例如: import pymysql str = 'as"sdf' print(pymysql.escape_string(str)) 阅读全文
posted @ 2019-12-04 08:25 WebLinuxStudy 阅读(842) 评论(0) 推荐(0)
 

2019年11月29日

摘要: import os filePath = 'D:\12345' # 判断文件夹是否存在,不存在则创建文件夹if not os.path.exists(filePath): os.makedirs(filePath) 阅读全文
posted @ 2019-11-29 14:39 WebLinuxStudy 阅读(2427) 评论(0) 推荐(1)