python爬虫--------Beautiful Soup 案列(二十一天)

news2024/11/26 3:07:04

🎈🎈作者主页: 喔的嘛呀🎈🎈
🎈🎈所属专栏:python爬虫学习🎈🎈
✨✨谢谢大家捧场,祝屏幕前的小伙伴们每天都有好运相伴左右,一定要天天开心哦!✨✨ 

目录

一、股票信息提取(http://quote.stockstar.com/)

1、首先打开网页

2、我们选取信息技术行业的股票,点进去。然后先复制网页地址http://quote.stockstar.com/stock/industry_I.shtml

3、然后点点击键盘上的F12打开开发工具分析网页结构,开始定位要爬取的数据对应的网页结构

4、提取定位的网页结构元素进行分析

5、分析完了,开写

(1)使用Beautiful Soup解析HTML代码:

(2)找到包含股票信息的表格:

(3)提取表格中的行数据:

(4)遍历每一行,提取股票信息:

(6)完整代码

6、结果演示

二、提取新浪新闻热榜新闻

三、结语


一、股票信息提取(http://quote.stockstar.com/)

1、首先打开网页

2、我们选取信息技术行业的股票,点进去。然后先复制网页地址http://quote.stockstar.com/stock/industry_I.shtml

3、然后点点击键盘上的F12打开开发工具分析网页结构,开始定位要爬取的数据对应的网页结构

上图可以看出爬取的数据都在box box_02这个盒子中

4、提取定位的网页结构元素进行分析

<div class="box box02">
    <div class="bg_box" id="dataTable">
        <div class="con">
        **//这里是股票所对应的表格 需要提取**
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="trHover" id="table1">
                <thead class="tbody_right">
                <tr>
                    <td width="6%" class="align_center">
                        <a href="javascript:void(0)" sort="0" target="_self" class="newup">代码</a>
                    </td>
                    <td width="24%" class="align_center">简称
                    </td>
                    <td width="17.5%" class="align_right">
                        <a href="javascript:void(0)" sort="1" target="_self">流通市值(万元)</a>
                    </td>
                    <td width="17.5%" class="align_right">
                        <a href="javascript:void(0)" sort="2" target="_self">总市值(万元)</a>
                    </td>
                    <td width="17.5%" class="align_right">
                        <a href="javascript:void(0)" sort="3" target="_self">流通股本(万元)</a>
                    </td>
                    <td width="17.5%" class="align_right">
                        <a href="javascript:void(0)" sort="4" target="_self">总股本(万元)</a>
                    </td>

                </tr>
                </thead>
                <tbody class="tbody_right" id="datalist">
               
                //start(从start到end是要每一行对应的股票信息,我们进行遍历,最后打印出来就好了)
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000004.shtml">000004</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000004.shtml">国华网安</a></td>
                    <td class="align_right ">190063.58</td>
                    <td class="align_right ">199232.32</td>
                    <td class="align_right ">12628.81</td>
                    <td class="align_right ">13238.03</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000032.shtml">000032</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000032.shtml">深桑达A</a></td>
                    <td class="align_right ">1166377.73</td>
                    <td class="align_right ">2058568.25</td>
                    <td class="align_right ">64476.38</td>
                    <td class="align_right ">113795.92</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000158.shtml">000158</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000158.shtml">常山北明</a></td>
                    <td class="align_right ">1224653.26</td>
                    <td class="align_right ">1235730.73</td>
                    <td class="align_right ">158428.62</td>
                    <td class="align_right ">159861.67</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000409.shtml">000409</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000409.shtml">云鼎科技</a></td>
                    <td class="align_right ">364104.22</td>
                    <td class="align_right ">581661.43</td>
                    <td class="align_right ">42337.70</td>
                    <td class="align_right ">67635.05</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000503.shtml">000503</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000503.shtml">国新健康</a></td>
                    <td class="align_right ">905071.39</td>
                    <td class="align_right ">991065.37</td>
                    <td class="align_right ">89877.99</td>
                    <td class="align_right ">98417.61</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000555.shtml">000555</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000555.shtml">神州信息</a></td>
                    <td class="align_right ">1166774.74</td>
                    <td class="align_right ">1170929.32</td>
                    <td class="align_right ">97231.23</td>
                    <td class="align_right ">97577.44</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000676.shtml">000676</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000676.shtml">智度股份</a></td>
                    <td class="align_right ">914176.97</td>
                    <td class="align_right ">915255.50</td>
                    <td class="align_right ">127500.28</td>
                    <td class="align_right ">127650.70</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000682.shtml">000682</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000682.shtml">东方电子</a></td>
                    <td class="align_right ">1222620.92</td>
                    <td class="align_right ">1222743.03</td>
                    <td class="align_right ">134059.31</td>
                    <td class="align_right ">134072.70</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000839.shtml">000839</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000839.shtml">ST国安</a></td>
                    <td class="align_right ">764366.14</td>
                    <td class="align_right ">764366.14</td>
                    <td class="align_right ">391982.64</td>
                    <td class="align_right ">391982.64</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000889.shtml">000889</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000889.shtml">ST中嘉</a></td>
                    <td class="align_right ">148744.29</td>
                    <td class="align_right ">160105.78</td>
                    <td class="align_right ">86984.97</td>
                    <td class="align_right ">93629.11</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000948.shtml">000948</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000948.shtml">南天信息</a></td>
                    <td class="align_right ">528632.72</td>
                    <td class="align_right ">539879.79</td>
                    <td class="align_right ">38614.52</td>
                    <td class="align_right ">39436.07</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000971.shtml">000971</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000971.shtml">ST高升</a></td>
                    <td class="align_right ">134618.70</td>
                    <td class="align_right ">166725.83</td>
                    <td class="align_right ">84665.85</td>
                    <td class="align_right ">104859.01</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/000997.shtml">000997</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/000997.shtml">新 大 陆</a></td>
                    <td class="align_right ">1788947.49</td>
                    <td class="align_right ">1798885.70</td>
                    <td class="align_right ">102636.12</td>
                    <td class="align_right ">103206.29</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002063.shtml">002063</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002063.shtml">远光软件</a></td>
                    <td class="align_right ">943962.50</td>
                    <td class="align_right ">1024941.65</td>
                    <td class="align_right ">175457.71</td>
                    <td class="align_right ">190509.60</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002065.shtml">002065</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002065.shtml">东华软件</a></td>
                    <td class="align_right ">1625588.07</td>
                    <td class="align_right ">1795070.13</td>
                    <td class="align_right ">290283.58</td>
                    <td class="align_right ">320548.24</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002093.shtml">002093</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002093.shtml">国脉科技</a></td>
                    <td class="align_right ">713868.17</td>
                    <td class="align_right ">714317.50</td>
                    <td class="align_right ">100686.62</td>
                    <td class="align_right ">100750.00</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002095.shtml">002095</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002095.shtml">生 意 宝</a></td>
                    <td class="align_right ">392665.13</td>
                    <td class="align_right ">394243.20</td>
                    <td class="align_right ">25170.84</td>
                    <td class="align_right ">25272.00</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002123.shtml">002123</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002123.shtml">梦网科技</a></td>
                    <td class="align_right ">650474.06</td>
                    <td class="align_right ">757978.52</td>
                    <td class="align_right ">68687.86</td>
                    <td class="align_right ">80039.97</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002131.shtml">002131</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002131.shtml">利欧股份</a></td>
                    <td class="align_right ">1309578.84</td>
                    <td class="align_right ">1515714.58</td>
                    <td class="align_right ">584633.41</td>
                    <td class="align_right ">676658.29</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002148.shtml">002148</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002148.shtml">北纬科技</a></td>
                    <td class="align_right ">249222.00</td>
                    <td class="align_right ">308537.10</td>
                    <td class="align_right ">45148.91</td>
                    <td class="align_right ">55894.40</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002153.shtml">002153</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002153.shtml">石基信息</a></td>
                    <td class="align_right ">1121434.43</td>
                    <td class="align_right ">1913164.88</td>
                    <td class="align_right ">159976.38</td>
                    <td class="align_right ">272919.38</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002174.shtml">002174</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002174.shtml">游族网络</a></td>
                    <td class="align_right ">916019.16</td>
                    <td class="align_right ">917717.77</td>
                    <td class="align_right ">91419.08</td>
                    <td class="align_right ">91588.60</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002195.shtml">002195</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002195.shtml">岩山科技</a></td>
                    <td class="align_right ">1674280.22</td>
                    <td class="align_right ">1694554.91</td>
                    <td class="align_right ">565635.21</td>
                    <td class="align_right ">572484.77</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002197.shtml">002197</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002197.shtml">证通电子</a></td>
                    <td class="align_right ">491566.64</td>
                    <td class="align_right ">565213.89</td>
                    <td class="align_right ">53431.16</td>
                    <td class="align_right ">61436.29</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002212.shtml">002212</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002212.shtml">天融信</a></td>
                    <td class="align_right ">811854.37</td>
                    <td class="align_right ">823376.63</td>
                    <td class="align_right ">116813.58</td>
                    <td class="align_right ">118471.46</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002230.shtml">002230</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002230.shtml">科大讯飞</a></td>
                    <td class="align_right ">10642815.24</td>
                    <td class="align_right ">11280510.86</td>
                    <td class="align_right ">218448.59</td>
                    <td class="align_right ">231537.58</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002232.shtml">002232</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002232.shtml">启明信息</a></td>
                    <td class="align_right ">637335.59</td>
                    <td class="align_right ">637335.59</td>
                    <td class="align_right ">40854.85</td>
                    <td class="align_right ">40854.85</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002235.shtml">002235</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002235.shtml">安妮股份</a></td>
                    <td class="align_right ">319414.68</td>
                    <td class="align_right ">334413.21</td>
                    <td class="align_right ">55357.83</td>
                    <td class="align_right ">57957.23</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002238.shtml">002238</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002238.shtml">天威视讯</a></td>
                    <td class="align_right ">898866.26</td>
                    <td class="align_right ">898866.26</td>
                    <td class="align_right ">80255.92</td>
                    <td class="align_right ">80255.92</td>
                </tr>
                <tr>
                    <td class="align_center select"><a href="//stock.quote.stockstar.com/002247.shtml">002247</a></td>
                    <td class="align_center"><a href="//stock.quote.stockstar.com/002247.shtml">聚力文化</a></td>
                    <td class="align_right ">108114.83</td>
                    <td class="align_right ">142946.17</td>
                    <td class="align_right ">64354.07</td>
                    <td class="align_right ">85087.00</td>
                </tr>
                //end
                </tbody>
                <tbody>
                <tr id="has_fyStock_data" class="noSelect no_trHover">
                    <td colspan="12" class="time notSelect">
                        <span class="fl" id="latesttime_span">数据时间:2024-03-29</span>
                        <div class="fenye fr" id="divPageControl1">共<strong>422</strong>条记录<span><em>1</em></span><a
                                href="/stock/industry_I_0_0_2.html" target="_self"><em>2</em></a><a
                                href="/stock/industry_I_0_0_3.html" target="_self"><em>3</em></a><a
                                href="/stock/industry_I_0_0_4.html" target="_self"><em>4</em></a><a
                                href="/stock/industry_I_0_0_5.html" target="_self"><em>5</em></a><em>...</em><a
                                href="/stock/industry_I_0_0_15.html" target="_self"><em>15</em></a><a
                                href="/stock/industry_I_0_0_2.html" target="_self"
                                class="n"><em>下一页</em></a>到第<input type="text" class="page_input"
                                                                        id="txtPageNumber"
                                                                        onkeydown="if (event.keyCode == 13){PagedControl.GoToThePage('/stock/industry_I_0_0_{0}.html');return false;}">页<a
                                href="javascript:void(0);"
                                onclick="PagedControl.GoToThePage('/stock/industry_I_0_0_{0}.html');return false;"><em>确定</em></a>
                        </div>
                    </td>
                </tr>

                </tbody>
            </table>
        </div>
    </div>
</div>

5、分析完了,开写

(1)使用Beautiful Soup解析HTML代码:


import requests                                          
from bs4 import BeautifulSoup                            
                                                         
url = "<http://quote.stockstar.com/stock/industry_I.shtml>"
response = requests.get(url)                             
response.encoding = 'gbk'  # 设置编码为 gbk                   
soup = BeautifulSoup(response.text, 'html.parser')       
                                                         

(2)找到包含股票信息的表格:


table = soup.find('table', class_='trHover')

(3)提取表格中的行数据:

rows = table.find_all('tr')

(4)遍历每一行,提取股票信息:

pythonCopy code
for row in rows[1:]:  # Skip the header row
    cells = row.find_all('td')
    if len(cells) >= 6:  # Ensure there are enough cells
        stock_code = cells[0].text.strip()
        stock_name = cells[1].text.strip()
        circulation_market_value = cells[2].text.strip()
        total_market_value = cells[3].text.strip()
        circulation_stock = cells[4].text.strip()
        total_stock = cells[5].text.strip()

        print(f"股票代码: {stock_code}, 股票名称: {stock_name}, 流通市值: {circulation_market_value}, 总市值: {total_market_value}, 流通股本: {circulation_stock}, 总股本: {total_stock}")

(6)完整代码

import requests                                                                
from bs4 import BeautifulSoup                                                  
                                                                               
url = "<http://quote.stockstar.com/stock/industry_I.shtml>"                      
response = requests.get(url)                                                   
response.encoding = 'gbk'  # 设置编码为 gbk   不设置这个编码会乱码                                      
soup = BeautifulSoup(response.text, 'html.parser')                             
                                                                               
table = soup.find('table', class_='trHover')                                   
rows = table.find_all('tr')                                                    
                                                                               
for row in rows[1:]:  # Skip the header row                                    
    cells = row.find_all('td')                                                 
    if len(cells) >= 6:  # Ensure there are enough cells                       
        stock_code = cells[0].text.strip()                                     
        stock_name = cells[1].text.strip()                                     
        circulation_market_value = cells[2].text.strip()                       
        total_market_value = cells[3].text.strip()                             
        circulation_stock = cells[4].text.strip()                              
        total_stock = cells[5].text.strip()                                    
                                                                               
        print(f"股票代码: {stock_code}, 股票名称: {stock_name}, "                      
              f"流通市值: {circulation_market_value}, 总市值: {total_market_value}, " 
              f"流通股本: {circulation_stock}, 总股本: {total_stock}")                
                                                                                                                         

这样就可以提取出表格中的股票信息了。如果你有其他需求或者需要进一步解析页面,请提供更多详细信息。

6、结果演示

二、提取新浪新闻热榜新闻

还是给以上的步骤一样

打开网页点F12提取要爬取数据的页面结构代码,分析,写出代码。

就是提取蓝色部分的网页结构代码

<div class="blk_main_card">
			<!-- 热榜 -->
			//blk_main_li为父元素
			<div class="blk_main_li" tab-type="tab-cont">
				<ul class="uni-blk-list02 list-a list-0427" style="padding-top: 7px;">
				<li><a href="<https://sinanews.sina.cn/native_zt/yingyanlandingpage1711786917>" data="0" target="_blank">小米汽车遭遇上百余名消费者投诉</a></li>
					<li><a href="<https://sinanews.sina.cn/native_page/quanzi_914931027323416577.html>" data="1" target="_blank">偷点外卖就不要写真实姓名了</a></li>
					<li id="hot_list_ad">
				<a id="hotlist_index_3" href="<https://s.weibo.com/weibo?q=%E5%93%AA%E4%BA%9B%E4%BA%BA%E5%AE%B9%E6%98%93%E5%BE%97%E7%99%BE%E6%97%A5%E5%92%B3>" data="2" target="_blank">哪些人容易得百日咳</a>
		<ins class="sinaads sinaads-fail" id="sinaads-right-hotlist" data-ad-pdps="PDPS000000067800" data-ad-width="360" data-ad-height="26" data-ad-type="embed" style="display:none" data-ad-status="done"></ins>
		   <script>(sinaads = window.sinaads || []).push({
        params: {
            element: document.getElementById("PDPS000000067800"),
            sinaads_success_handler:function () {
                  var ads = document.getElementById("sinaads-right-hotlist");
				  var _news= document.getElementById("hotlist_index_3");
				  var hot_list_ad= document.getElementById("hot_list_ad")
				  _news.style.display="none";
			      ads.style.display= "block";
				  hot_list_ad.classList.add("hotlist_have_ad")
            },
            sinaads_fail_handler: function () {
                console.log('sinaads_fail_handler')
            }
        }
    })</script>
    
		</li>
		
		//热榜新闻都被包含在li标签中
					<li><a href="<https://sinanews.sina.cn/native_zt/yingyanlandingpage1711790585>" data="3" target="_blank">杭州东站</a></li>
					<li><a href="<https://sinanews.sina.cn/native_page/quanzi_914336910352965633.html>" data="4" target="_blank">2024中国网络媒体论坛</a></li>
					<li><a href="<https://sinanews.sina.cn/native_page/quanzi_914966334487650305.html>" data="5" target="_blank">雷军能不能生产一下相机</a></li>
					<li><a href="<https://sinanews.sina.cn/native_zt/yingyanlandingpage1711790450>" data="6" target="_blank">医院取精室里都有些什么</a></li>
					<li><a href="<https://k.sina.com.cn/article_5756451891_m1571c7c3303301b0u4.html?from=news&amp;subch=onews>" data="7" target="_blank">警方辟谣面具男用病毒针扎人</a></li>
					<li><a href="<https://finance.sina.cn/2024-03-30/detail-inaqawts0171984.d.html>" data="8" target="_blank">殡葬用品店否认南通烧纸普遍2层楼高</a></li>
					<li><a href="<https://sinanews.sina.cn/native_zt/yingyanlandingpage1711790306>" data="9" target="_blank">花间令女性群像没有郑合惠子</a></li>
					<li><a class="fe661" href="<https://sinanews.sina.cn/h5/top_news_list.d.html>" data="10" target="_blank">点击查看更多实时热点</a></li>
			
</ul>
			</div>
					</div>

分析以后写出代码

import requests
from bs4 import BeautifulSoup

# 网页 URL
url = '<https://news.sina.com.cn/>'

# 发送 GET 请求并获取响应
response = requests.get(url)

# 使用 BeautifulSoup 解析 HTML 内容
soup = BeautifulSoup(response.content, 'html.parser')

# 找到热榜新闻所在的父元素
hot_news_parent = soup.find('div', class_='blk_main_li')

# 找到所有热榜新闻条目
hot_news_list = hot_news_parent.find_all('li')

# 遍历热榜新闻列表并提取信息
for news_item in hot_news_list:
    # 提取新闻标题和链接
    news_title = news_item.a.text.strip()  # 获取新闻标题文本并去除首尾空格
    news_link = news_item.a['href']  # 获取新闻链接

    # 打印新闻标题和链接
    print(f"标题: {news_title}\\n链接: {news_link}\\n")

结果:

三、结语

通过今天的案例练习和实践,我们可以进一步加深对Beautiful Soup的理解和运用。在进行网页爬取时,记得遵守网站的爬虫规则,不要频繁请求或者过度抓取,以免对网站造成影响。同时,保持学习的态度,不断探索和尝试新的技术和方法,提高自己的爬虫能力和效率。不管做什么都一样,祝兄弟姐妹们在自己的道路上取得更多的成就!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1592421.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

JRT多平台初始化程序

这么多年客户端一直只做Windows&#xff0c;所以初始化程序用C#写个Exe&#xff0c;按网站生成的下载清单文件一个个下载和部署客户端环境是可以的。新的由于设计目标就是支持多平台的&#xff0c;所以需要重新考虑初始化设计。 JRT-Linux初始化演示 JRT-Windows初始化演示 …

【STL详解 —— list的介绍及使用】

STL详解 —— list的介绍及使用 list的介绍list的介绍使用list的构造list iterator的使用list capacitylist element accesslist modifiers 示例list的迭代器失效 list的介绍 list是可以在常数范围内在任意位置进行插入和删除的序列式容器&#xff0c;并且该容器可以前后双向迭…

Linux内核中KASLR功能是什么?有什么作用?怎么破除?以及如何实操?(地址空间、layout random、kallsyms)

1. 背景 KASLR是一个什么技术点其实不重要&#xff0c;但重要的是有了KASLR这个功能后&#xff0c;造成内核中某个符号&#xff08;函数 or 变量&#xff09;在System.map中的地址和实际不一样了&#xff08;实际&#xff1a; cat /proc/kallsyms&#xff09;&#xff0c;进一…

vector及cv::Mat删除指定元素并不改变位置

1、vector删除指定元素且不改变原有的顺序 使用erase方法&#xff0c;测试例子如下所示&#xff1a; //测试用例 struct MyStruct {int a;int b; }; std::vector<MyStruct> spotInfo; spotInfo.push_back({ 1,2 }); spotInfo.push_back({ 3,4 }); spotInfo.push_back({…

SSM整合时的配置文件

文章目录 SSM整合时的配置文件pom.xmlweb.xmlmybatis-config.xmlspring-mvc.xmlspring-mapper.xmldatabase.propertiesapplication.xml项目结构图 SSM整合时的配置文件 pom.xml <?xml version"1.0" encoding"UTF-8"?> <project xmlns"ht…

蓝桥杯第2152题——红绿灯

问题描述 爱丽丝要开车去上班, 上班的路上有许多红绿灯, 这让爱丽丝很难过。为 了上班不迟到, 她给自己的车安装了氮气喷射装置。现在她想知道自己上班最 短需要多少时间。 爱丽丝的车最高速度是 米每秒, 并且经过改装后, 可以瞬间加速到小于 等于最高速的任意速度, 也可以瞵…

【从浅学到熟知Linux】环境变量详谈(含使用程序获取环境变量的3种方法、如何查看环境变量)

&#x1f3e0;关于专栏&#xff1a;Linux的浅学到熟知专栏用于记录Linux系统编程、网络编程及数据库等内容。 &#x1f3af;每天努力一点点&#xff0c;技术变化看得见 文章目录 环境变量基本概念查看环境变量的方法环境变量相关命令环境变量组织方式及获取环境变量的3种方法验…

链表中常见的使用方法逻辑整理

文章目录 1. 二叉树特点1.1 完全二叉树1.2 满二叉树 2. 二叉树创建2.1 通过先序序列带有叶子结点标识符创建二叉树2.2 通过层次遍历顺序创建二叉树2.3 通过 先序中序 创建二叉树2.4 通过 先序中序 创建二叉树2.5 通过 中序后序 创建二叉树 3. 二叉树遍历通用方法3.1 先序遍历(深…

【软考中级】软件设计师考点分布

文章目录 软考官网资格设置软考报考流程 【软件设计师】考点分布选择题考点分布案例题考点分布 软考官网 中国计算机技术职业资格网&#xff1a;https://www.ruankao.org.cn/ 官网报名平台&#xff1a;https://bm.ruankao.org.cn/sign/welcome 资格设置 计算机软件计算机网…

SSM整合配置案例

一、什么是SSM整合 SSM整合用到两个容器&#xff0c;web容器是root容器的子容器&#xff0c;父子容器关系。 为了方便编写&#xff0c;我们可以三层架构每层对应一个配置类&#xff0c;分别指定两个容器加载 Ioc如何初始化&#xff1f; 二、简单实现整合SSM &#xff08;一…

是的,本科毕业八年,我考研了

今天&#xff0c;是一篇纯分享文。 是的&#xff0c;本科毕业八年&#xff0c;我考研了。 停更10个月&#xff0c;历时296天&#xff0c;我考研上岸了。 小伙伴们&#xff0c;好久不见。 一 发今年第一篇文章的时候刚处理完后续事宜&#xff0c;就简单说了句&#xff0c;后台…

QThread的学习

锁住该线程直到下面的情况之一出现&#xff1a; (1)和该线程连接的对象已经执行完成&#xff08;例如&#xff1a;当它从run()中返回时&#xff09; 如果该线程已经结束&#xff0c;该函数将返回true。 如果该线程还没有开始&#xff0c;它也返回true。 (2)time毫秒已经过去。如…

Linux 内核学习(2) --- regulator 框架

目录 Regulator 介绍Regulator provider 注册struct regulator_descstruct regualtor_configDTS 配置和解析On BoardConfig 配置regulator_ops总结 Regulator Consumer 使用struct regulator 获取regulator 操作使用Multi Regulator 参考博客 Regulator 介绍 Regulator 指的是…

电子烟特效音语音方案选型-WTN6020-8S-E

随着科技的迅猛进步&#xff0c;电子烟行业亦在持续创新与突破&#xff0c;引领着全新的潮流。其中&#xff0c;电子烟产品所特有的吸烟声音特效播报功能&#xff0c;无疑成为了技术革新的璀璨亮点。这一设计巧妙地将吸烟的声效融入使用体验中&#xff0c;使得用户在吸电子烟时…

Javascript 斐波那契搜索-迭代与递归(Fibonacci Search)

给定一个大小为 n 的排序数组 arr[] 和要在其中搜索的元素 x。如果 x 存在于数组中&#xff0c;则返回 x 的索引&#xff0c;否则返回 -1。 例子&#xff1a; 输入&#xff1a; arr[] {2, 3, 4, 10, 40}, x 10输出&#xff1a; 3 元素 x 出现在索引 3 处。 输入&#xff1…

HarmonyOS开发实例:【app帐号管理】

应用帐号管理 介绍 本示例选择应用进行注册/登录&#xff0c;并设置帐号相关信息&#xff0c;简要说明应用帐号管理相关功能。效果图如下&#xff1a; 效果预览 使用说明参考鸿蒙文档&#xff1a;qr23.cn/AKFP8k点击或者转到。 1.首页面选择想要进入的应用&#xff0c;首次进…

【Redis】持久化

文章目录 一、RDB1.1、RDB的自动备份与手动备份1.1.1、自动备份1.1.2、手动备份 1.2、RDB优点1.3、RDB缺点1.4、RDB快照1.5、RDB优化配置项 二、AOF2.1、AOF工作流程2.2、AOF写回策略2.3、MP-AOF实现2.4、AOF优缺点2.5、AOF重写机制 三、RDBAOF混合持久化3.1、数据恢复顺序和加…

生产环境中秒杀接口并发量剧增与负载优化策略探讨

✨✨谢谢大家捧场&#xff0c;祝屏幕前的小伙伴们每天都有好运相伴左右&#xff0c;一定要天天开心哦&#xff01;✨✨ &#x1f388;&#x1f388;作者主页&#xff1a; 喔的嘛呀&#x1f388;&#x1f388; 目录 引言 1. 实施限流措施 1.1 令牌桶算法&#xff1a; 1.2 漏…

如何申请阿里云服务器学生优惠,入口在这呢!

阿里云学生服务器免费申请&#xff0c;之前是云翼计划学生服务器9元/月&#xff0c;现在是高校计划&#xff0c;学生服务器可以免费申请&#xff0c;先完成学生认证即可免费领取一台云服务器ECS&#xff0c;配置为2核2G、1M带宽、40G系统盘&#xff0c;在云服务器ECS实例过期之…

什么是队头阻塞以及如何解决

前言 通常我们提到队头阻塞&#xff0c;指的可能是TCP协议中的队头阻塞&#xff0c;但是HTTP1.1中也有一个类似TCP队头阻塞的问题&#xff0c;下面各自介绍一下。 TCP队头阻塞 队头阻塞&#xff08;head-of-line blocking&#xff09;发生在一个TCP分节丢失&#xff0c;导致…