学习 第5页
个人学习记录

python-pymysql

import pymysql #需求:在world数据库中,创建一张student表 #1.连接数据库 db=pymysql.connect(host='localhost',user='root',passwd='123456789',db='world') #创建一个游标对象 cursor=db.cu...
iu不错哦的头像-北梦の博客iu不错哦10个月前
0131

python-课堂-5.30

#创建3个线程,每个线程包括2个子线程 import threading import time def process(): for i in range(2): time.sleep(2) print('线程的名称:{}'.format(threading.currentThread().name))#thre...
iu不错哦的头像-北梦の博客iu不错哦11个月前
0191

Python5.24练习

# 进程:正在进行的一个过程或者一个任务 # multiprocessing模块:用来开启子进程,并在子进程中执行任务 # 使用process类创建两个子进程 from multiprocessing import Process import os import...
珊瑚海的头像-北梦の博客珊瑚海11个月前
0211

5.23_python_课堂练习

# UDP协议:面向消息的协议,通信时是不需要建立连接的,相对于tcp协议安全性不高,适用于多点通信,例如聊天软件,语音广播 # 案例:建立udp通信获取客户购物的数量 import socket sock = socke...
X.蔡徐坤的头像-北梦の博客X.蔡徐坤11个月前
0231

5.17练习python

1 import socket host = socket.gethostname() port=8081 serversock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) serversock.bind((host,port)) serversock.listen(5) print('等待客户...
珊瑚海的头像-北梦の博客珊瑚海11个月前
0171

python-课堂笔记(5.10)

import re #1.re.findall()函数:查找字符串中所有匹配的子串,返回值类型是列表,如果未匹配到,则返回一个空列表而不是none # str1='qwertyuioppoiu0516q' # a=re.findall('i',str1) # print(a...
iu不错哦的头像-北梦の博客iu不错哦11个月前
0121

python-课堂笔记-5.9

import re str1 = 'my naaaame is iu' #从开始位置去进行匹配 # print(re.match('my', str1).group(0)) # #search()是从整个字符串中查找和正则表达式匹配的字符串 # print(re.search('iu', str...
iu不错哦的头像-北梦の博客iu不错哦11个月前
0141

Linux_练习_24.4.26

练习1 1、查看当前位置是否有文件有隐藏权限 lsattr 2、创建文件test1,设置隐藏权限,任何用户也无法删除创建的文件,并验证 touch test1 lsattr test1 chattr +i test1 lsattr test1 rm test1...
北梦的头像-北梦の博客SVIP北梦12个月前
0361

Python_函数练习题

1. 编写一个函数,该函数接收两个数字作为输入,并返回这两个数字的最大公约数。 def fun(x, y): while y != 0: temp = y y = x % y x = temp return x num1 = int(input('请输入第一个数字: '...
北梦的头像-北梦の博客SVIP北梦2年前
01807

MySQL_练习_24.3.11

-- (1)删除数据库 drop database if exists t3; -- (2)创建数据库 create database if not exists t3; -- (3)使用数据库 use t3; -- 删除数据表 drop table if exists book; -- 在t3中创建数据...
北梦的头像-北梦の博客SVIP北梦1年前
09211