大三上實訓內容

項目一:爬取天氣預報數據

【內容】
在中國天氣網(http://www.weather.com.cn)中輸入城市的名稱,例如輸入信陽,進入http://www.weather.com.cn/weather1d/101180601.shtml#input
的網頁顯示信陽的天氣預報,其中101180601是信陽的代碼,每個城市或者地區都有一個代碼。如下圖所示,請爬取河南所有城市15天的天氣預報數據。
1到7天代碼
import requests
from bs4 import BeautifulSoup
import csvheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36','Accept-Encoding': 'gzip, deflate'
}
city_list = [101180101,101180901,101180801,101180301,101180501,101181101,101180201,101181201,101181501,101180701,101180601,101181401,101181001,101180401,101181701,101181601,101181301]
city_name_dict = {101180101: "鄭州市",101180901: "洛陽市",101180801: "開封市",101180301: "新鄉市",101180501: "平頂山市",101181101: "焦作市",101180201: "安陽市",101181201: "鶴壁市",101181501: "漯河市",101180701: "南陽市",101180601: "信陽市",101181401: "周口市",101181001: "商丘市",101180401: "許昌市",101181701: "三門峽市",101181601: "駐馬店市",101181301: "濮陽"
}# 創建csv文件
with open('河南地級市7天天氣情況.csv', 'w', newline='', encoding='utf-8') as csvfile:csv_writer = csv.writer(csvfile)# 寫入表頭csv_writer.writerow(['City ID', 'City Name', 'Weather Info'])for city in city_list:city_id = citycity_name = city_name_dict.get(city_id, "未知城市")print(f"City ID: {city_id}, City Name: {city_name}")url = f'http://www.weather.com.cn/weather/{city}.shtml'response = requests.get(headers=headers, url=url)soup = BeautifulSoup(response.content.decode('utf-8'), 'html.parser')# 找到v<div id="7d" class="c7d">標簽v_div = soup.find('div', {'id': '7d'})# 提取v<div id="7d" class="c7d">下的天氣相關的網頁信息weather_info = v_div.find('ul', {'class': 't clearfix'})# 提取li標簽下的內容,每個標簽下的分行打印,移除打印結果之間的空格weather_list = []for li in weather_info.find_all('li'):weather_list.append(li.text.strip().replace('\n', ''))# 將城市ID、城市名稱和天氣信息寫入csv文件csv_writer.writerow([city_id, city_name, ', '.join(weather_list)])
8到15天的代碼
import requests
from bs4 import BeautifulSoup
import csvheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36','Accept-Encoding': 'gzip, deflate'
}
city_list = [101180101, 101180901, 101180801, 101180301, 101180501, 101181101, 101180201, 101181201, 101181501,101180701, 101180601, 101181401, 101181001, 101180401, 101181701, 101181601, 101181301]
city_name_dict = {101180101: "鄭州市",101180901: "洛陽市",101180801: "開封市",101180301: "新鄉市",101180501: "平頂山市",101181101: "焦作市",101180201: "安陽市",101181201: "鶴壁市",101181501: "漯河市",101180701: "南陽市",101180601: "信陽市",101181401: "周口市",101181001: "商丘市",101180401: "許昌市",101181701: "三門峽市",101181601: "駐馬店市",101181301: "濮陽"
}
# 創建csv文件
with open('河南地級市8-15天天氣情況.csv', 'w', newline='', encoding='utf-8') as csvfile:csv_writer = csv.writer(csvfile)# 寫入表頭csv_writer.writerow(['City ID', 'City Name', 'Weather Info'])for city in city_list:city_id = citycity_name = city_name_dict.get(city_id, "未知城市")print(f"City ID: {city_id}, City Name: {city_name}")url = f'http://www.weather.com.cn/weather15d/{city}.shtml'response = requests.get(headers=headers, url=url)soup = BeautifulSoup(response.content.decode('utf-8'), 'html.parser')# 找到v<div id="15d" class="c15d">標簽v_div = soup.find('div', {'id': '15d'})# 提取v<div id="15d" class="c15d">下的天氣相關的網頁信息weather_info = v_div.find('ul', {'class': 't clearfix'})# 提取li標簽下的信息for li in weather_info.find_all('li'):time = li.find('span', {'class': 'time'}).textwea = li.find('span', {'class': 'wea'}).texttem = li.find('span', {'class': 'tem'}).textwind = li.find('span', {'class': 'wind'}).textwind1 = li.find('span', {'class': 'wind1'}).textcsv_writer.writerow([city_id, city_name, f"時間:{time},天氣:{wea},溫度:{tem},風向:{wind},風力:{wind1}"])
15天代碼
import requests
from bs4 import BeautifulSoup
import csvheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36','Accept-Encoding': 'gzip, deflate'
}
city_list = [101180101, 101180901, 101180801, 101180301, 101180501, 101181101, 101180201, 101181201, 101181501,101180701, 101180601, 101181401, 101181001, 101180401, 101181701, 101181601, 101181301]
city_name_dict = {101180101: "鄭州市",101180901: "洛陽市",101180801: "開封市",101180301: "新鄉市",101180501: "平頂山市",101181101: "焦作市",101180201: "安陽市",101181201: "鶴壁市",101181501: "漯河市",101180701: "南陽市",101180601: "信陽市",101181401: "周口市",101181001: "商丘市",101180401: "許昌市",101181701: "三門峽市",101181601: "駐馬店市",101181301: "濮陽"
}# 創建csv文件
with open('河南地級市1-15天天氣情況.csv', 'w', newline='', encoding='utf-8') as csvfile:csv_writer = csv.writer(csvfile)# 寫入表頭csv_writer.writerow(['City ID', 'City Name', 'Weather Info'])for city in city_list:city_id = citycity_name = city_name_dict.get(city_id, "未知城市")print(f"City ID: {city_id}, City Name: {city_name}")# 爬取1-7天天氣情況url_7d = f'http://www.weather.com.cn/weather/{city}.shtml'response_7d = requests.get(headers=headers, url=url_7d)soup_7d = BeautifulSoup(response_7d.content.decode('utf-8'), 'html.parser')v_div_7d = soup_7d.find('div', {'id': '7d'})weather_info_7d = v_div_7d.find('ul', {'class': 't clearfix'})weather_list_7d = []for li in weather_info_7d.find_all('li'):weather_list_7d.append(li.text.strip().replace('\n', ''))# 爬取8-15天天氣情況url_15d = f'http://www.weather.com.cn/weather15d/{city}.shtml'response_15d = requests.get(headers=headers, url=url_15d)soup_15d = BeautifulSoup(response_15d.content.decode('utf-8'), 'html.parser')v_div_15d = soup_15d.find('div', {'id': '15d'})weather_info_15d = v_div_15d.find('ul', {'class': 't clearfix'})weather_list_15d = []for li in weather_info_15d.find_all('li'):time = li.find('span', {'class': 'time'}).textwea = li.find('span', {'class': 'wea'}).texttem = li.find('span', {'class': 'tem'}).textwind = li.find('span', {'class': 'wind'}).textwind1 = li.find('span', {'class': 'wind1'}).textweather_list_15d.append(f"時間:{time},天氣:{wea},溫度:{tem},風向:{wind},風力:{wind1}")# 將城市ID、城市名稱和天氣信息寫入csv文件csv_writer.writerow([city_id, city_name, ', '.join(weather_list_7d+weather_list_15d)])

項目二:爬取紅色旅游數據

【內容】
?? 信陽是大別山革命根據地,紅色旅游資源非常豐富,爬取http://www.bytravel.cn/view/red/index441_list.html 網頁的紅色旅游景點,并在地圖上標注出來。
相關代碼
import requests  # 導入requests庫,用于發送HTTP請求
import csv  # 導入csv庫,用于處理CSV文件
from bs4 import BeautifulSoup  # 導入BeautifulSoup庫,用于解析HTML文檔headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0 Safari/537.36','Accept-Encoding': 'gzip, deflate'  # 設置請求頭,模擬瀏覽器訪問
}# 創建csv文件并寫入表頭
csv_file = open('信陽紅色景點.csv', 'w', newline='', encoding='utf-8')  # 打開csv文件,以寫入模式
csv_writer = csv.writer(csv_file)  # 創建csv寫入對象
csv_writer.writerow(['景點名稱', '景點簡介', '星級', '圖片鏈接'])  # 寫入表頭# 爬取第一頁
url = 'http://www.bytravel.cn/view/red/index441_list.html'  # 定義要爬取的網頁URL
response = requests.get(headers=headers, url=url)  # 發送GET請求,獲取網頁內容
soup = BeautifulSoup(response.content.decode('gbk'), 'html.parser')  # 使用BeautifulSoup解析網頁內容target_div = soup.find('div', {'style': 'margin:5px 10px 0 10px'})  # 在解析后的HTML中查找目標divfor div in target_div.find_all('div', {'style': 'margin:2px 10px 0 7px;padding:3px 0 0 0'}):  # 在目標div中查找所有符合條件的子divtitle_element = div.find('a', {'class': 'blue14b'})  # 在子div中查找標題元素if title_element:  # 如果找到了標題元素title = title_element.text  # 獲取標題文本else:title = "未找到標題"  # 如果沒有找到標題元素,設置默認值Introduction_element = div.find('div', id='tctitletop102')  # 在子div中查找簡介元素if Introduction_element:  # 如果找到了簡介元素intro = Introduction_element.text.strip().replace("[詳細]", "")  # 獲取簡介文本,去除首尾空格和"[詳細]"標記else:intro = "無簡介"  # 如果沒有找到簡介元素,設置默認值star_element = div.find('font', {'class': 'f14'})  # 在子div中查找星級元素if star_element:  # 如果找到了星級元素star = star_element.text  # 獲取星級文本else:star = "無星級"  # 如果沒有找到星級元素,設置默認值img_url_element = div.find('img', {'class': 'hpic'})  # 在子div中查找圖片鏈接元素if img_url_element:  # 如果找到了圖片鏈接元素img_url = img_url_element['src']  # 獲取圖片鏈接else:img_url = "無圖片鏈接"  # 如果沒有找到圖片鏈接元素,設置默認值print('景點名稱:', title)  # 打印景點名稱print('景點簡介:', intro)  # 打印景點簡介print('星級:', star)  # 打印星級print('圖片鏈接:', img_url)  # 打印圖片鏈接# 將數據寫入csv文件csv_writer.writerow([title, intro, star, img_url])  # 將景點名稱、簡介、星級和圖片鏈接寫入csv文件# 爬取第二頁到第五頁
for page in range(1, 5):  # 遍歷第二頁到第五頁url = f'http://www.bytravel.cn/view/red/index441_list{page}.html'  # 構造每一頁的URLresponse = requests.get(headers=headers, url=url)  # 發送GET請求,獲取網頁內容soup = BeautifulSoup(response.content.decode('gbk'), 'html.parser')  # 使用BeautifulSoup解析網頁內容target_div = soup.find('div', {'style': 'margin:5px 10px 0 10px'})  # 在解析后的HTML中查找目標divfor div in target_div.find_all('div', {'style': 'margin:2px 10px 0 7px;padding:3px 0 0 0'}):  # 在目標div中查找所有符合條件的子divtitle_element = div.find('a', {'class': 'blue14b'})  # 在子div中查找標題元素if title_element:  # 如果找到了標題元素title = title_element.text  # 獲取標題文本else:title = "未找到標題"  # 如果沒有找到標題元素,設置默認值Introduction_element = div.find('div', id='tctitletop102')  # 在子div中查找簡介元素if Introduction_element:  # 如果找到了簡介元素intro = Introduction_element.text.strip().replace("[詳細]", "")  # 獲取簡介文本,去除首尾空格和"[詳細]"標記else:intro = "無簡介"  # 如果沒有找到簡介元素,設置默認值star_element = div.find('font', {'class': 'f14'})  # 在子div中查找星級元素if star_element:  # 如果找到了星級元素star = star_element.text  # 獲取星級文本else:star = "無星級"  # 如果沒有找到星級元素,設置默認值img_url_element = div.find('img', {'class': 'hpic'})  # 在子div中查找圖片鏈接元素if img_url_element:  # 如果找到了圖片鏈接元素img_url = img_url_element['src']  # 獲取圖片鏈接else:img_url = "無圖片鏈接"  # 如果沒有找到圖片鏈接元素,設置默認值print('景點名稱:', title)  # 打印景點名稱print('景點簡介:', intro)  # 打印景點簡介print('星級:', star)  # 打印星級print('圖片鏈接:', img_url)  # 打印圖片鏈接# 將數據寫入csv文件csv_writer.writerow([title, intro, star, img_url])  # 將景點名稱、簡介、星級和圖片鏈接寫入csv文件# 關閉csv文件
csv_file.close()

項目三:豆瓣網爬取top250電影數據

【內容】
運用scrapy框架從豆瓣電影top250網站爬取全部上榜的電影信息,并將電影的名稱、評分、排名、一句影評、劇情簡介分別保存都mysql 和mongodb 庫里面。

douban.py
import scrapy  # 導入scrapy庫
from scrapy import Selector, Request  # 從scrapy庫中導入Selector和Request類
from scrapy.http import HtmlResponse  # 從scrapy庫中導入HtmlResponse類
from ..items import DoubanspidersItem  # 從當前目錄下的items模塊中導入DoubanspidersItem類class DoubanSpider(scrapy.Spider):  # 定義一個名為DoubanSpider的爬蟲類,繼承自scrapy.Spidername = 'douban'  # 設置爬蟲的名稱為'douban'allowed_domains = ['movie.douban.com']  # 設置允許爬取的域名為'movie.douban.com'# start_urls = ['http://movie.douban.com/top250']  # 設置起始URL,但注釋掉了,所以不會自動開始爬取def start_requests(self):  # 定義start_requests方法,用于生成初始請求for page in range(10):  # 循環10次,每次生成一個請求,爬取豆瓣電影Top250的前10頁數據yield Request(url=f'https://movie.douban.com/top250?start={page * 25}&filt=')  # 使用yield關鍵字返回請求對象,Scrapy會自動處理請求并調用回調函數def parse(self, response: HtmlResponse, **kwargs):  # 定義parse方法,用于解析響應數據sel = Selector(response)  # 使用Selector類解析響應數據list_items = sel.css('#content > div > div.article > ol > li')  # 使用CSS選擇器提取電影列表項for list_item in list_items:  # 遍歷電影列表項detail_url = list_item.css('div.info > div.hd > a::attr(href)').extract_first()  # 提取電影詳情頁的URLmovie_item = DoubanspidersItem()  # 創建一個DoubanspidersItem實例movie_item['name'] = list_item.css('span.title::text').extract_first()  # 提取電影名稱movie_item['score'] = list_item.css('span.rating_num::text').extract_first()  # 提取電影評分movie_item['top'] = list_item.css('div.pic em ::text').extract_first()  # 提取電影排名yield Request(  # 使用yield關鍵字返回請求對象,Scrapy會自動處理請求并調用回調函數url=detail_url, callback=self.parse_movie_info, cb_kwargs={'item': movie_item})def parse_movie_info(self, response, **kwargs):  # 定義parse_movie_info方法,用于解析電影詳情頁數據movie_item = kwargs['item']  # 獲取傳入的DoubanspidersItem實例sel = Selector(response)  # 使用Selector類解析響應數據movie_item['comment'] = sel.css('div.comment p.comment-content span.short::text').extract_first()  # 提取電影評論movie_item['introduction'] = sel.css('span[property="v:summary"]::text').extract_first().strip() or ''  # 提取電影簡介yield movie_item  # 返回處理后的DoubanspidersItem實例,Scrapy會自動處理并保存結果
items.py

import scrapyclass DoubanspidersItem(scrapy.Item):# define the fields for your item here like:# name = scrapy.Field()# passtop = scrapy.Field()name = scrapy.Field()score = scrapy.Field()introduction = scrapy.Field()comment = scrapy.Field()
pipelines.py
from itemadapter import ItemAdapter
import openpyxl
import pymysqlclass DoubanspidersPipeline:def __init__(self):self.conn = pymysql.connect(host='localhost',port=3306,user='root',password='789456MLq',db='sx_douban250',charset='utf8mb4')self.cursor = self.conn.cursor()self.data = []def close_spider(self,spider):if len(self.data) > 0:self._write_to_db()self.conn.close()def process_item(self, item, spider):self.data.append((item['top'],item['name'],item['score'],item['introduction'],item['comment']))if len(self.data) == 100:self._writer_to_db()self.data.clear()return itemdef _writer_to_db(self):self.cursor.executemany('insert into doubantop250 (top,name,score,introduction,comment)''values (%s,%s,%s,%s,%s)',self.data)self.conn.commit()from pymongo import MongoClientclass MyMongoDBPipeline:def __init__(self):self.client = MongoClient('mongodb://localhost:27017/')self.db = self.client['sx_douban250']self.collection = self.db['doubantop250']self.data = []def close_spider(self, spider):if len(self.data) > 0:self._write_to_db()self.client.close()def process_item(self, item, spider):self.data.append({'top': item['top'],'name': item['name'],'score': item['score'],'introduction': item['introduction'],'comment': item['comment']})if len(self.data) == 100:self._write_to_db()self.data.clear()return itemdef _write_to_db(self):self.collection.insert_many(self.data)self.data.clear()class ExcelPipeline:def __init__(self):self.wb = openpyxl.Workbook()self.ws = self.wb.activeself.ws.title = 'Top250'self.ws.append(('排名','評分','主題','簡介','評論'))def open_spider(self,spider):passdef close_spider(self,spider):self.wb.save('豆瓣Top250.xlsx')def process_item(self,item,spider):self.ws.append((item['top'], item['name'], item['score'], item['introduction'], item['comment']))return item
settings.py相關內容修改

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/207543.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/207543.shtml
英文地址,請注明出處:http://en.pswp.cn/news/207543.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

SpringCloud面試題——Nacos

一&#xff1a;什么是Nacos&#xff1f; 二&#xff1a;服務心跳與服務注冊原理&#xff1f; 在spring容器啟動的時候&#xff0c;nacos客戶端會進行兩步操作。 向nacos服務端發送心跳向nacos服務端注冊當前服務 服務心跳 客戶端在啟動的時候&#xff0c;會開啟一個心跳線程…

私域運營:掌控用戶,領航變革

隨著互聯網技術的迅速進步&#xff0c;眾多電商平臺如雨后春筍般涌現。盡管淘寶、京東等第三方平臺在流量和銷售額方面占據了絕對優勢&#xff0c;但私域流量運營的興起也引發了廣泛關注。盡管尚處于初級階段&#xff0c;但私域運營已成為當前最熱門的話題之一。 私域運營指的…

HttpComponents: 概述

文章目錄 1. 概述2. 生態位 1. 概述 早期的Java想要實現HTTP客戶端需要借助URL/URLConnection或者自己手動從Socket開始編碼&#xff0c;需要處理大量HTTP協議的具體細節&#xff0c;不但繁瑣還容易出錯。 Apache Commons HttpClient的誕生就是為了解決這個問題&#xff0c;它…

高德地圖畫漸變線

高德地圖畫漸變線&#xff0c;思路是將線和顏色均分為多個小線段和小顏色&#xff0c;實現漸變&#xff0c;類似于下圖。 如果需要多段線&#xff0c;自己循環拼一下就可以了&#xff0c;方法返回多個小線段組成的polyline數組。 /** 高德地圖畫漸變線* author: liyun* params…

【WPS】Excel表格數據透視表

數據少量還好&#xff0c;如果輸數多起來就麻煩了&#xff0c;最近需要匯報一個情況。 描述 譬如&#xff1a;開發&#xff08;80.00%->91.16%&#xff09;&#xff1a;共計43項&#xff08;本周新增1項&#xff09;&#xff0c;本周新增已完成2項&#xff0c;共已完成36項…

wps中將橫軸和縱軸數據互換

wps中將橫軸和縱軸數據互換 今天遇到個比較奇怪的需求, 要把excel數據的橫軸和縱軸互換 在我理解中程序做這種事情應該很簡單的 結果搜索好多教程都是說怎么講圖表xy軸互換 終于找到如何轉表格數據的特此記錄一下 復制需要轉換的內容新建一個sheet選擇性粘貼(CtrlAltV)選擇轉置…

Linux高級系統編程 - 5 管道

復制文件描述符 dup函數 作用 : 文件描述符復制 語法 #include <unistd.h> int dup(int oldfd); 參數 : 所需復制的文件描述符 返回值 復制得到的文件描述符 功能 : 從文件描述符表中 , 尋找一個最小可能的文件描述符&#xff08;通過返回值返回&#xff09;作為…

Java--作用域,構造器,this

作用域基本使用 在Java編程中&#xff0c;主要的變量就是屬性&#xff08;成員變量&#xff09;和局部變量。 我們說的局部變量一般是指在成員方法中定義的變量 Java中作用域的分類 全局變量&#xff1a;也就是屬性&#xff0c;作用域為整個類體 局部變量&#xff1a;也就是除了…

RHEL8_Linux訪問NFS存儲及自動掛載

本章主要介紹NFS客戶端的使用 創建FNS服務器并通過NFS共享一個目錄在客戶端上訪問NFS共享的目錄自動掛載的配置和使用 1.訪問NFS存儲 前面介紹了本地存儲&#xff0c;本章就來介紹如何使用網絡上的存儲設備。NFS即網絡文件系統&#xff0c;所實現的是 Linux 和 Linux 之間的共…

新手搭建知識付費平臺必備攻略:如何以低成本實現高轉化?

我有才知識付費平臺 一、引言 隨著知識經濟的崛起&#xff0c;越來越多的知識提供者希望搭建自己的知識付費平臺。然而&#xff0c;對于新手來說&#xff0c;如何以低成本、高效率地實現這一目標&#xff0c;同時滿足自身需求并提高客戶轉化率&#xff0c;是一大挑戰。本文將…

SPA, SEO, SSR總結

SPA單頁面Web應用 SPA(Single page web application) 單頁面Web應用 Web不再是一張張頁面,而是一個整體的應用,一個由路由系統,數據系統,頁面(組件)系統等等,組成的應用程序, 讓用戶不需要每次與服務器進行頁面刷新來獲得新的內容, 從而提供了更快,跟流暢的用戶體驗, 在SPA中…

參與創作①周年啦~

寫在前面 今天看了消息才知道&#xff0c;原來開始創作已經一年了。此篇無干貨&#xff0c;純白話&#xff0c;純記錄。 機緣 參與CSDN創作已經一年有余&#xff0c;猶記得第一篇博文是為了整理好所學內容&#xff0c;方便自己復習。沒想到后面也陸陸續續發了些其他內容&…

關于read函數阻塞的問題

關于read函數阻塞的問題 上一篇文章IO多路轉接之select 末尾提到了一點&#xff0c;服務端讀取每次是讀取10個字節的&#xff0c;如果超過10個字節&#xff0c;需要讀取多次&#xff0c;但是客戶端只會read一次&#xff0c;第二次read的時候&#xff0c;直接阻塞了。 那么如何…

Windows server flask

1、Windows server 通過python的flask執行命令 from flask import Flask, request, abort import subprocess from flask_basicauth import BasicAuth app Flask(__name__) # 獲取url是進行賬號密碼認證&#xff0c;設置url的賬號密碼 app.config[BASIC_AUTH_USERNAME] 賬號…

12.8作業

1.頭文件 #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QDebug> #include <QMovie>QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACEclass Widget : public QWidget {Q_OBJECTpublic:Widget(QWidget *parent nul…

spring-boot-starter-validation是什么Validation參數校驗使用概要

spring-boot-starter-validation是什么&Validation參數校驗使用概要 來源Valid和Validated的用法(區別)引入依賴Valid和Validated的用法 在日常的項目開發中&#xff0c;為了防止非法參數對業務造成的影響&#xff0c;需要對接口的參數做合法性校驗&#xff0c;例如在創建用…

基于Docker安裝Mysql:5.5

一、拉取鏡像 sudo docker pull mysql:5.5二、啟動mysql鏡像 1. 創建MySQL的conf目錄和data目錄 mkdir -p /home/docker/mysql/conf /home/docker/mysql/data2. 利用鏡像創建容器 sudo docker run --restartalways -d --name mysql -v /home/docker/mysql/conf/my.cnf:/etc…

系統設計-微服務架構

典型的微服務架構圖 下圖展示了一個典型的微服務架構。 負載均衡器&#xff1a;它將傳入流量分配到多個后端服務。CDN&#xff08;內容交付網絡&#xff09;&#xff1a;CDN 是一組地理上分布的服務器&#xff0c;用于保存靜態內容以實現更快的交付。客戶端首先在 CDN 中查找內…

methods

類型&#xff1a;{ [key: string]: Function } 詳細&#xff1a; methods 將被混入到 Vue 實例中。可以直接通過 VM 實例訪問這些方法&#xff0c;或者在指令表達式中使用。方法中的 this 自動綁定為 Vue 實例。 注意&#xff0c;不應該使用箭頭函數來定義 method 函數 (例如…

臨床骨科常用的肩關節疾病量表,醫生必備!

根據骨科醫生的量表使用情況&#xff0c;常笑醫學整理了臨床骨科常用的肩關節疾病量表&#xff0c;為大家分享臨床常見的肩關節疾病量表評估內容&#xff0c;均支持量表下載和在線使用&#xff0c;建議收藏&#xff01; 1.臂、肩、手功能障礙&#xff08;disabilites of the ar…