摘要:
创建数据库 mysql> create database lesson53; Query OK, 1 row affected (0.01 sec) 创建第一张表 CREATE TABLE lesson53.ClassCharger( id TINYINT PRIMARY KEY auto_incr 阅读全文
摘要:
创建django 在django_lesson下的urls.py 添加路径 from django.contrib import admin from django.urls import path from blog import views urlpatterns = [ path('admin 阅读全文
摘要:
数据库 -- 1.创建数据库(在磁盘上创建一个对应的文件夹) create database [if not exists] db_name [character set xxx] -- 2.查看数据库 show databases;查看所有数据库 show create database db_n 阅读全文
摘要:
os.path.isfile 检查路径是否是一个文件 如果是一个存在的文件,返回True。否则返回False。 >>> import os >>> pathvar = "/mnt/hgfs/gongxiang_16/day16/2.py" >>> res = os.path.isfile(pathv 阅读全文
摘要:
试了很多的都不行 最后找到了这段代码 >>> import pip._internal.pep425tags >>> print(pip._internal.pep425tags.get_supported()) [<cp38-cp38-win32 @ 59527464>, <cp38-abi3-w 阅读全文
摘要:
在一个进程中 开三个子进程(不只单纯使用一个CPU) import multiprocessing import time def mult(name): time.sleep(1) print('hello',name,time.ctime()) if __name__ == '__main__' 阅读全文
摘要:
先进先出 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: 阅读全文
摘要:
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 阅读全文
摘要:
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) #找到端 阅读全文
摘要:
错误与异常 try: age = input('1==>') int(age) num = input('2==>') int(num) except ValueError as e: print(e) 多分支异常处理 try: age = input('1==>') int(age) num = 阅读全文