摘要: 阅读全文
posted @ 2020-04-10 21:58 linux——quan 阅读(175) 评论(0) 推荐(0)
摘要: mysql> USE mon Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Datab 阅读全文
posted @ 2020-04-10 21:48 linux——quan 阅读(498) 评论(3) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-10 21:46 linux——quan 阅读(106) 评论(0) 推荐(0)
摘要: 结果 阅读全文
posted @ 2020-04-10 21:45 linux——quan 阅读(180) 评论(0) 推荐(0)
摘要: t = ("a","b","c",1,2) print(t) print(t[2]) print(t[-1]) print(t[1:4]) print('b' in t) #元组创建后不可变 #写入数据的函数也不支持 #特殊情况,如果元组内持有列表,那么列表的内容是允许被修改的 t2 = (['a' 阅读全文
posted @ 2020-04-10 21:44 linux——quan 阅读(184) 评论(0) 推荐(0)
摘要: mysql> SHOW DATABASES; + + | Database | + + | information_schema | | m1 | | mon | | mysql | | performance_schema | | quan; | | quanbbs | | quantest | 阅读全文
posted @ 2020-04-10 21:43 linux——quan 阅读(187) 评论(0) 推荐(0)
摘要: 一定要按照这个顺序,where group by having order by limit 可以进行一次排序之后再一次拍寻 #存储的时候,能存数字就村数字 阅读全文
posted @ 2020-04-10 21:42 linux——quan 阅读(133) 评论(0) 推荐(0)
摘要: #参数可以设置默认值,如果调用参数的时候没有给出改参数的值,则使用默认值进行调用 def calc_exchange_rate(amt,source,target = "USD"): print(target) if source == "CNY" and target == "USD": resu 阅读全文
posted @ 2020-04-10 21:41 linux——quan 阅读(261) 评论(0) 推荐(0)
摘要: win +R d 阅读全文
posted @ 2020-04-10 21:40 linux——quan 阅读(147) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-10 21:39 linux——quan 阅读(129) 评论(0) 推荐(0)
摘要: 进行自定义包调用的时候 如果将包视为文件夹,可以直接通过 from work(报名字) import toos(包里面的文件名) 然后再通过 toos.gen_trans_id()(文件里面的函数名字)调用 这种情况不能通过import work调用 如果要通过import work直接调用,wor 阅读全文
posted @ 2020-04-10 21:38 linux——quan 阅读(258) 评论(0) 推荐(0)
摘要: pip install virtualenv 安装虚拟环境工具 -win是指win版本 mkvirtualenv venv 创建虚拟环境 workon 查看当前的虚拟环境目录 workon django1.11 切换到虚拟环境 deactivate 退出虚拟环境 rmvirtualenv djang 阅读全文
posted @ 2020-04-10 21:37 linux——quan 阅读(144) 评论(0) 推荐(0)
摘要: def use_filer(l): """ 获取指定列表/元组中的奇数 :param l: lsit/tuple :return: """ rest = filter(lambda n:n % 2 != 0,l) return rest if __name__ == '__main__': l = 阅读全文
posted @ 2020-04-10 21:36 linux——quan 阅读(223) 评论(0) 推荐(0)
摘要: 将文件的打开和关闭,交给上下文管理工具with去实现。 def read_file(): """ 读取文件 :return: """ file_path1 = 'D:\\PycharmProjects\\p1\\text.txt' file_path2 = 'D:/PycharmProjects/p 阅读全文
posted @ 2020-04-10 21:35 linux——quan 阅读(683) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-10 21:33 linux——quan 阅读(111) 评论(0) 推荐(0)
摘要: self 表示类里面的对象的引用 python一般不需要去解决内存管理,解释器会进行自动给回收 #类鱼类之间空格两行,前面的函数里面也是两行,类里面的方法个一行 class Cat(object): """ 猫科动物 """ def __init__(self,name,age,sex=None): 阅读全文
posted @ 2020-04-10 21:32 linux——quan 阅读(253) 评论(0) 推荐(0)
摘要: def hello(): print("hello") def test(): print("test") def hello_wrapper(): print("aaa") hello() print("bbbb") def test_wrapper(): print("aaaa") hello( 阅读全文
posted @ 2020-04-10 21:31 linux——quan 阅读(194) 评论(0) 推荐(0)
摘要: def test_div(num1,num2): return num1 / num2 if __name__ == "__main__": try: print(test_div(5,"a")) except ZeroDivisionError: print("除数不能为零") except Ty 阅读全文
posted @ 2020-04-10 21:30 linux——quan 阅读(197) 评论(0) 推荐(0)
摘要: 恢复内容开始 python实现实现实现实现 import re #将表达式编译,返回一个对象, pattern = re.compile(r"hello",re.I)#re.I忽略大小写 print(dir(pattern)) #使用对象的方法,通过match匹配 rest = pattern.ma 阅读全文
posted @ 2020-04-10 21:29 linux——quan 阅读(256) 评论(0) 推荐(0)
摘要: 333333333333333333333333333 mysql> DESC user; + + + + + + + | Field | Type | Null | Key | Default | Extra | + + + + + + + | id | int(11) | NO | PRI | 阅读全文
posted @ 2020-04-10 21:28 linux——quan 阅读(224) 评论(0) 推荐(0)
摘要: 666666666666666666666666 如多带有通配符的,要使用一下格式 select * from user where usename like "%1\%" ESCAPE 1; 再通配符前面使用1 后面加上ESCAPE告诉1 是不用解析的 注意:上面的FOWER是错的,改为POWER 阅读全文
posted @ 2020-04-10 21:27 linux——quan 阅读(263) 评论(0) 推荐(0)
摘要: python对于I/O密集型应用比较好,具体根据是什么类型应用来查看 对于cpu密集型应用可以借助python的一些扩展去实现 thread模块是比较早期的模块,thresding是比较新的模块,对thread模块进行了新的封装, import threading def loop(): """新线 阅读全文
posted @ 2020-04-10 21:26 linux——quan 阅读(251) 评论(0) 推荐(0)
摘要: import os import time from multiprocessing.dummy import Process def so_sth(name): print("进程名称{},{}".format(name, os.getpid())) time.sleep(5) print("进程 阅读全文
posted @ 2020-04-10 21:25 linux——quan 阅读(163) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-10 21:24 linux——quan 阅读(123) 评论(0) 推荐(0)
摘要: 1.网页登录百度网盘:https://pan.baidu.com/2.百度输入法生成:http://pcs.baidu.com/rest/2.0/pcs/file?app_id=265486&method=list&path=%2F打开这个链接会提示错误,不用管,此步会在你的网盘我的应用数据目录下生 阅读全文
posted @ 2020-04-10 21:23 linux——quan 阅读(2379) 评论(0) 推荐(0)
摘要: cc 阅读全文
posted @ 2020-04-10 21:22 linux——quan 阅读(124) 评论(0) 推荐(0)
摘要: mysql> CREATE TABLE joson( id INT AUTO_INCREMENT PRIMARY KEY, context JSON NOT NULL)// Query OK, 0 rows affected (0.05 sec) mysql> DESC joson; + + + + 阅读全文
posted @ 2020-04-10 21:21 linux——quan 阅读(180) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-10 21:20 linux——quan 阅读(140) 评论(0) 推荐(0)
摘要: 协程是我们自己调度的 进程是系统调度的协程切换很少开销 python3.5之前的实现方法 def yield_test(): """实现协程函数""" while True: n = (yield) print(n) if __name__ == "__main__": rest = yield_t 阅读全文
posted @ 2020-04-10 21:19 linux——quan 阅读(217) 评论(0) 推荐(0)
摘要: 问题: ImportError: No module named dns.resolver 解决: 通过包管理工具pip安装dnspython pip install dnspython 阅读全文
posted @ 2020-04-10 21:18 linux——quan 阅读(173) 评论(0) 推荐(0)
摘要: connect 模块下载 https://dev.mysql.com/downloads/connector/python/ import mysql.connector con = mysql.connector.connect( host = "192.168.111.153", port = 阅读全文
posted @ 2020-04-10 21:09 linux——quan 阅读(230) 评论(0) 推荐(0)
摘要: python中检测某个变量是否有定义 第一种方法使用内置函数locals(): locals():获取已定义对象字典 'testvar' in locals().keys() 第二种方法使用内置函数dir(): dir():获取已定义对象列表 'testvar' in dir() 第三种方法使用内置 阅读全文
posted @ 2020-04-10 21:08 linux——quan 阅读(1887) 评论(0) 推荐(0)
摘要: 给查询对象起个别名。 把查询对像起个别名的作用。 select ID as 用户ID,Name as 用户名 from Table_user 阅读全文
posted @ 2020-04-10 21:06 linux——quan 阅读(1533) 评论(0) 推荐(0)
摘要: #div1{ background-color: yellow; width: 150px; height:150px; position: absolute; top:150px; left: 150px; overflow: scroll; } 结果: #div1{ background-col 阅读全文
posted @ 2020-04-10 16:26 linux——quan 阅读(660) 评论(0) 推荐(0)
摘要: MySQL UNION 操作符用于连接两个以上的 SELECT 语句的结果组合到一个结果集合中。多个 SELECT 语句会删除重复的数据。 语法 MySQL UNION 操作符语法格式: SELECT expression1, expression2, ... expression_n FROM t 阅读全文
posted @ 2020-04-10 14:09 linux——quan 阅读(97) 评论(0) 推荐(0)