上一页 1 2 3 4 5 6 ··· 32 下一页
摘要: print(hello.encode()) # b'hello world1'print(memoryview(hello.encode())) #<memory at 0x00000263CAD23700>print(memoryview(hello.encode()).tobytes().dec 阅读全文
posted @ 2022-06-18 16:42 zhishaofei3 阅读(31) 评论(0) 推荐(0) 编辑
摘要: import sqlite3 conn = sqlite3.connect('play.sqlite') cur = conn.cursor() # 如果存在就删除 # cur.executescript(''' # DROP TABLE IF EXISTS User; # CREATE TABLE 阅读全文
posted @ 2022-06-17 15:16 zhishaofei3 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 主键约束(PRIMARY KEY)主键约束的特点:主键约束相当于唯一性约束+ 非空约束,主键约束不允许重复,也不允许出现空值 一个表最多只能有一个主键约束,建立主键约束可以在列级别创建,也可以再表级别创建 主键约束对应着表中的一列或者多列 对应着多列的时候就是复合主键(可以类比我们之前讲过的复合唯一 阅读全文
posted @ 2022-06-16 23:37 zhishaofei3 阅读(462) 评论(0) 推荐(0) 编辑
摘要: track.py: import xml.etree.ElementTree as ET import sqlite3 conn = sqlite3.connect('trackdb.sqlite') cur = conn.cursor() # Make some fresh tables usin 阅读全文
posted @ 2022-06-16 11:37 zhishaofei3 阅读(56) 评论(0) 推荐(0) 编辑
摘要: import xml.etree.ElementTree as ET data = ''' <person> <name>Chuck</name> <phone type="intl"> +1 734 303 4456 </phone> <email hide="yes" /> </person>' 阅读全文
posted @ 2022-06-12 17:18 zhishaofei3 阅读(32) 评论(0) 推荐(0) 编辑
摘要: beautifulsoup 解析html库 https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/ html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> 阅读全文
posted @ 2022-06-12 17:05 zhishaofei3 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 使用内置urllib: import urllib.request, urllib.parse, urllib.error fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt') for line in fhand: prin 阅读全文
posted @ 2022-06-12 15:39 zhishaofei3 阅读(29) 评论(0) 推荐(0) 编辑
摘要: import socket mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect(('data.pr4e.org', 80)) cmd = 'GET http://data.pr4e.org/romeo.t 阅读全文
posted @ 2022-06-12 15:27 zhishaofei3 阅读(18) 评论(0) 推荐(0) 编辑
摘要: main.py: from user import User from post import Post app_user_one = User("nn@nn.com", "Nana Janshi", "pwd1", "DevOps Engineer") app_user_one.get_user_ 阅读全文
posted @ 2022-06-12 14:34 zhishaofei3 阅读(6) 评论(0) 推荐(0) 编辑
摘要: import openpyxl inv_file = openpyxl.load_workbook("inventory.xlsx") product_list = inv_file["Sheet1"] products_per_supplier = {} total_value_per_suppl 阅读全文
posted @ 2022-06-11 17:58 zhishaofei3 阅读(94) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 32 下一页