2020年4月29日
摘要: 创建数据库 mysql> create database lesson53; Query OK, 1 row affected (0.01 sec) 创建第一张表 CREATE TABLE lesson53.ClassCharger( id TINYINT PRIMARY KEY auto_incr 阅读全文
posted @ 2020-04-29 20:38 -脑子坏了- 阅读(4920) 评论(0) 推荐(0) 编辑
2020年4月28日
摘要: 创建django 在django_lesson下的urls.py 添加路径 from django.contrib import admin from django.urls import path from blog import views urlpatterns = [ path('admin 阅读全文
posted @ 2020-04-28 20:02 -脑子坏了- 阅读(169) 评论(0) 推荐(0) 编辑
2020年4月3日
摘要: 数据库 -- 1.创建数据库(在磁盘上创建一个对应的文件夹) create database [if not exists] db_name [character set xxx] -- 2.查看数据库 show databases;查看所有数据库 show create database db_n 阅读全文
posted @ 2020-04-03 13:23 -脑子坏了- 阅读(152) 评论(0) 推荐(0) 编辑
2020年3月4日
摘要: os.path.isfile 检查路径是否是一个文件 如果是一个存在的文件,返回True。否则返回False。 >>> import os >>> pathvar = "/mnt/hgfs/gongxiang_16/day16/2.py" >>> res = os.path.isfile(pathv 阅读全文
posted @ 2020-03-04 14:09 -脑子坏了- 阅读(197) 评论(0) 推荐(0) 编辑
2020年3月2日
摘要: 试了很多的都不行 最后找到了这段代码 >>> import pip._internal.pep425tags >>> print(pip._internal.pep425tags.get_supported()) [<cp38-cp38-win32 @ 59527464>, <cp38-abi3-w 阅读全文
posted @ 2020-03-02 14:19 -脑子坏了- 阅读(774) 评论(0) 推荐(0) 编辑
2020年2月28日
摘要: 在一个进程中 开三个子进程(不只单纯使用一个CPU) import multiprocessing import time def mult(name): time.sleep(1) print('hello',name,time.ctime()) if __name__ == '__main__' 阅读全文
posted @ 2020-02-28 16:29 -脑子坏了- 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 先进先出 import queue q =queue.Queue() #FIFO q.put(12) q.put('hello') q.put({"name":"yuan"}) print(q.qsize()) print(q.full()) print(q.empty()) while True: 阅读全文
posted @ 2020-02-28 12:38 -脑子坏了- 阅读(135) 评论(0) 推荐(0) 编辑
2020年1月16日
摘要: tcp服务端 from socket import * import subprocess import struct ip_port =('127.0.0.1',8080) back_log = 5 buffer_size = 1024 tcp_server = socket(AF_INET,SO 阅读全文
posted @ 2020-01-16 10:38 -脑子坏了- 阅读(264) 评论(0) 推荐(0) 编辑
摘要: udp服务端 from socket import * ip_port = ('127.0.0.1',8080) buffer_size = 1024 udp_server = socket(AF_INET,SOCK_DGRAM) #数据报 udp_server.bind(ip_port) #找到端 阅读全文
posted @ 2020-01-16 10:34 -脑子坏了- 阅读(203) 评论(0) 推荐(0) 编辑
2020年1月11日
摘要: 错误与异常 try: age = input('1==>') int(age) num = input('2==>') int(num) except ValueError as e: print(e) 多分支异常处理 try: age = input('1==>') int(age) num = 阅读全文
posted @ 2020-01-11 15:37 -脑子坏了- 阅读(884) 评论(0) 推荐(0) 编辑