当前位置:首页 > 文章列表 > 文章 > python教程 > Python谷歌搜索技巧与结果分析教程

Python谷歌搜索技巧与结果分析教程

2025-12-11 09:36:34 0浏览 收藏

本篇文章主要是结合我之前面试的各种经历和实战开发中遇到的问题解决经验整理的,希望这篇《Python谷歌搜索高级用法与结果解析教程》对你有很大帮助!欢迎收藏,分享给更多的需要的朋友学习~

Python googlesearch模块高级搜索与结果解析教程

本教程旨在解决使用Python `googlesearch`模块时遇到的`advanced`参数`TypeError`问题,并详细阐述如何通过该模块进行Google搜索,以及如何进一步获取搜索结果的详细描述(即实现网页内容抓取)。文章将澄清不同`googlesearch`包的差异,提供正确的安装与使用方法,并结合`requests`和`BeautifulSoup4`库,演示从搜索结果页面提取标题和摘要的完整流程,帮助开发者高效、准确地获取网络信息。

1. googlesearch模块简介与advanced参数的困惑

googlesearch是一个方便Python开发者进行Google搜索的第三方库,它能够模拟浏览器行为,获取搜索结果的URL列表。然而,用户在使用过程中常遇到search()函数不接受advanced参数的TypeError,这通常源于对不同googlesearch相关包的混淆以及对模块功能的误解。

1.1 TypeError: search() got an unexpected keyword argument 'advanced' 的原因

这个错误通常表明您当前安装的googlesearch库版本或具体实现中,search()函数并不支持名为advanced的关键字参数。在Python生态系统中,存在多个名称相似但功能和API略有差异的库,例如:

  • google 包 (PyPI: google):这是最常见且广泛使用的googlesearch实现,通常通过pip install google安装,导入时为from googlesearch import search。这个包的search函数不包含advanced参数,它主要用于迭代返回搜索结果的URL。
  • googlesearch-python 包 (PyPI: googlesearch-python):您提到的文档链接(pypi.org/project/googlesearch-python)指向的是这个包。尽管其文档中可能提及advanced参数,但实际功能和默认行为可能与用户的预期(直接返回描述)不符,或者您安装的版本可能过旧或不兼容。TypeError可能意味着即使是googlesearch-python,在特定版本下也可能不支持该参数,或者您实际安装的是google包而非googlesearch-python。

1.2 正确的安装与验证

为了确保您使用的是文档中提及的googlesearch-python包,请尝试使用以下命令重新安装或更新:

pip install googlesearch-python --upgrade

安装完成后,可以通过查看模块的帮助文档来验证其支持的参数:

from googlesearch import search
help(search)

这将显示search函数的签名和可用参数。如果advanced参数仍然不在其中,则说明您当前使用的库版本或实现确实不支持此参数用于直接返回描述。

2. googlesearch模块的基本使用

无论使用哪个版本的googlesearch,其核心功能都是获取搜索结果的URL。以下是基本的用法示例:

from googlesearch import search

query = "Python web scraping tutorial"
num_results = 5 # 限制搜索结果数量

print(f"Searching for: '{query}'")
for url in search(query, num_results=num_results, stop=num_results, pause=2):
    print(url)

参数说明:

  • query: 您的搜索关键词。
  • num_results (或 num): 每次请求返回的搜索结果数量(可能不是最终迭代的总数)。
  • stop: 停止迭代的总结果数量。当获取到指定数量的结果后,迭代会停止。
  • pause: 每次请求之间暂停的秒数,用于模拟人类行为,避免被Google检测为机器人而封锁IP。

3. 获取搜索结果描述:结合网页抓取技术

googlesearch模块本身通常只返回URL。要获取每个URL对应的标题、摘要或其他详细信息,您需要进行二次操作,即“网页抓取”(Web Scraping)。这意味着在获取到URL列表后,您需要逐一访问这些URL,并解析其HTML内容以提取所需信息。

我们将使用requests库来发送HTTP请求获取网页内容,并使用BeautifulSoup4库来解析HTML。

3.1 安装必要的库

pip install requests beautifulsoup4

3.2 示例代码:获取URL及对应页面的标题和描述

import requests
from bs4 import BeautifulSoup
from googlesearch import search
import time

def get_page_details(url):
    """
    访问指定URL,并尝试提取页面的标题和元描述。
    """
    try:
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
        }
        response = requests.get(url, headers=headers, timeout=10)
        response.raise_for_status()  # 检查HTTP错误
        soup = BeautifulSoup(response.text, 'html.parser')

        # 提取标题
        title = soup.title.string if soup.title else 'No Title Found'

        # 提取元描述 (meta description)
        description = 'No Description Found'
        meta_description = soup.find('meta', attrs={'name': 'description'})
        if meta_description and 'content' in meta_description.attrs:
            description = meta_description['content'].strip()
        elif soup.find('p'): # 如果没有meta description,尝试提取第一个段落作为描述
            description = soup.find('p').get_text(strip=True)[:200] + '...' # 限制长度

        return title, description
    except requests.exceptions.RequestException as e:
        print(f"Error accessing {url}: {e}")
        return 'Error', 'Error'
    except Exception as e:
        print(f"Error parsing {url}: {e}")
        return 'Error', 'Error'

if __name__ == "__main__":
    search_query = "Python flask rest api tutorial"
    max_results_to_process = 5 # 限制处理的搜索结果数量

    print(f"Performing Google search for: '{search_query}'")
    found_urls = []
    for url in search(search_query, num_results=10, stop=max_results_to_process, pause=2):
        found_urls.append(url)
        print(f"Found URL: {url}")
        time.sleep(1) # 在获取每个URL后稍作暂停

    print("\n--- Fetching details for found URLs ---")
    for i, url in enumerate(found_urls):
        print(f"\nProcessing result {i+1}/{len(found_urls)}: {url}")
        title, description = get_page_details(url)
        print(f"  Title: {title}")
        print(f"  Description: {description}")
        time.sleep(3) # 在访问每个页面后暂停,避免被目标网站封锁

代码解析:

  1. get_page_details(url) 函数:
    • 使用requests.get()方法访问每个搜索结果的URL。为了模拟真实浏览器,我们添加了User-Agent请求头。
    • response.raise_for_status()用于检查HTTP请求是否成功。
    • BeautifulSoup(response.text, 'html.parser')将网页的HTML内容解析成一个可操作的对象。
    • soup.title.string提取页面的标签内容。</li><li>soup.find('meta', attrs={'name': 'description'})尝试查找HTML中的元描述标签。如果找到,则提取其content属性作为描述。</li><li>如果未找到元描述,作为备用方案,我们尝试提取页面中第一个<p>标签的文本作为描述,并限制其长度。</li><li>包含错误处理,以应对网络问题或解析失败。</li></ul></li><li><strong>主程序流程:</strong><ul><li>首先使用googlesearch.search()获取一系列URL。</li><li>然后遍历这些URL,对每个URL调用get_page_details()函数来获取详细信息。</li><li>在googlesearch的请求之间以及访问每个目标页面之间都加入了time.sleep(),这是<strong>非常重要</strong>的,可以有效降低被Google或目标网站封锁的风险。</li></ul></li></ol><h3>4. 注意事项与替代方案</h3><ul><li><strong>频率限制与IP封锁:</strong> 频繁地进行自动化搜索和抓取很容易触发Google或目标网站的频率限制,导致您的IP被暂时或永久封锁。务必使用time.sleep(),并考虑使用代理IP池。</li><li><strong>用户代理 (User-Agent):</strong> 始终在requests请求中设置User-Agent头,使其看起来像一个真实的浏览器请求。</li><li><strong>遵守robots.txt:</strong> 在抓取任何网站之前,最好检查其robots.txt文件,了解哪些内容可以抓取,哪些不可以。</li><li><strong>网站结构变化:</strong> 网页的HTML结构可能会随时改变,导致您的BeautifulSoup选择器失效。您的抓取代码需要定期维护和更新。</li><li><strong>Google Custom Search API:</strong> 如果您需要更稳定、更官方的Google搜索结果,并且愿意支付费用,可以考虑使用Google Custom Search API。它提供了结构化的JSON响应,包含标题、摘要和URL等信息,无需进行网页抓取。</li></ul><h3>5. 总结</h3><p>googlesearch模块是进行Python自动化Google搜索的强大工具,但它主要用于获取URL。对于获取搜索结果的详细描述(如标题和摘要),需要结合requests和BeautifulSoup4等网页抓取库进行二次处理。理解不同googlesearch包的差异,正确处理advanced参数的TypeError,并遵循网页抓取的最佳实践(如设置延迟、User-Agent和错误处理),是成功实现自动化信息获取的关键。对于大规模或商业用途,官方API通常是更稳定和可靠的选择。</p><p>到这里,我们也就讲完了《Python谷歌搜索技巧与结果分析教程》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于的知识点!</p> </div> <div class="labsList"> </div> <div class="cateBox"> <div class="cateItem"> <a href="/article/416235.html" title="JavaScript原型链解析:继承与属性查找全解" class="img_box"> <img src="/uploads/20251211/1765416984693a2018a8cd9.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="JavaScript原型链解析:继承与属性查找全解">JavaScript原型链解析:继承与属性查找全解 </a> <dl> <dt class="lineOverflow"><a href="/article/416235.html" title="JavaScript原型链解析:继承与属性查找全解" class="aBlack">上一篇<i></i></a></dt> <dd class="lineTwoOverflow">JavaScript原型链解析:继承与属性查找全解</dd> </dl> </div> <div class="cateItem"> <a href="/article/416237.html" title="Java对象比较:引用与值区别解析" class="img_box"> <img src="/uploads/20251211/1765417000693a20282cf51.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="Java对象比较:引用与值区别解析"> </a> <dl> <dt class="lineOverflow"><a href="/article/416237.html" class="aBlack" title="Java对象比较:引用与值区别解析">下一篇<i></i></a></dt> <dd class="lineTwoOverflow">Java对象比较:引用与值区别解析</dd> </dl> </div> </div> </div> </div> <div class="leftContBox pt0"> <div class="pdl20"> <div class="contTit"> <a href="/articlelist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit">最新文章</div> </div> </div> <ul class="newArticleList"> <li> <div class="contBox"> <a href="/article/631487.html" class="img_box" title="Python Polars表达式与普通Python函数有什么区别"> <img src="/uploads/20261013/1791894187-133004bcc5-690e81e963-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Polars表达式与普通Python函数有什么区别"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/1141_new_0_1.html" class="aLightGray" title="表达式">表达式</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="/articletag/3145_new_0_1.html" class="aLightGray" title="数据处理">数据处理</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="Python函数">Python函数</a> <a href="javascript:;" class="aLightGray" title="dataframe">dataframe</a> <a href="javascript:;" class="aLightGray" title="Polars">Polars</a> <a href="javascript:;" class="aLightGray" title="Expr">Expr</a> <a href="javascript:;" class="aLightGray" title="map_elements">map_elements</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631487.html" class="aBlack" target="_blank" title="Python Polars表达式与普通Python函数有什么区别">Python Polars表达式与普通Python函数有什么区别</a> </dt> <dd class="cont2"> <span><i class="view"></i>480浏览</span> <span class="collectBtn user_collection" data-id="631487" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631486.html" class="img_box" title="Python Jinja子模板怎样补充而不是替换父区块"> <img src="/uploads/20261013/1791894179-6edf660a30-83ffcd8682-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Jinja子模板怎样补充而不是替换父区块"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="extends">extends</a> <a href="javascript:;" class="aLightGray" title="super">super</a> <a href="javascript:;" class="aLightGray" title="模板继承">模板继承</a> <a href="javascript:;" class="aLightGray" title="block">block</a> <a href="javascript:;" class="aLightGray" title="Jinja">Jinja</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631486.html" class="aBlack" target="_blank" title="Python Jinja子模板怎样补充而不是替换父区块">Python Jinja子模板怎样补充而不是替换父区块</a> </dt> <dd class="cont2"> <span><i class="view"></i>468浏览</span> <span class="collectBtn user_collection" data-id="631486" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631485.html" class="img_box" title="Python Jinja按模板后缀开启自动转义怎么配置"> <img src="/uploads/20261013/1791893865-9cba4d54c1-16e02bf638-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Jinja按模板后缀开启自动转义怎么配置"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   </span> </dd> <dt class="lineOverflow"> <a href="/article/631485.html" class="aBlack" target="_blank" title="Python Jinja按模板后缀开启自动转义怎么配置">Python Jinja按模板后缀开启自动转义怎么配置</a> </dt> <dd class="cont2"> <span><i class="view"></i>320浏览</span> <span class="collectBtn user_collection" data-id="631485" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631484.html" class="img_box" title="Python Jinja StrictUndefined怎样暴露缺失模板变量"> <img src="/uploads/20261013/1791893802-a1cee94b7b-c4683b2d16-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Jinja StrictUndefined怎样暴露缺失模板变量"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="模板变量">模板变量</a> <a href="javascript:;" class="aLightGray" title="Jinja">Jinja</a> <a href="javascript:;" class="aLightGray" title="StrictUndefined">StrictUndefined</a> <a href="javascript:;" class="aLightGray" title="UndefinedError">UndefinedError</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631484.html" class="aBlack" target="_blank" title="Python Jinja StrictUndefined怎样暴露缺失模板变量">Python Jinja StrictUndefined怎样暴露缺失模板变量</a> </dt> <dd class="cont2"> <span><i class="view"></i>477浏览</span> <span class="collectBtn user_collection" data-id="631484" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631483.html" class="img_box" title="Python Typer布尔选项怎样设置正反开关"> <img src="/uploads/20261013/1791893667-4a85e199f9-d6c5bc76a8-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Typer布尔选项怎样设置正反开关"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/301_new_0_1.html" class="aLightGray" title="命令行">命令行</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="bool">bool</a> <a href="javascript:;" class="aLightGray" title="typer">typer</a> <a href="javascript:;" class="aLightGray" title="CLI选项">CLI选项</a> <a href="javascript:;" class="aLightGray" title="布尔开关">布尔开关</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631483.html" class="aBlack" target="_blank" title="Python Typer布尔选项怎样设置正反开关">Python Typer布尔选项怎样设置正反开关</a> </dt> <dd class="cont2"> <span><i class="view"></i>208浏览</span> <span class="collectBtn user_collection" data-id="631483" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631482.html" class="img_box" title="Python Textual Worker取消后怎样处理清理逻辑"> <img src="/uploads/20261013/1791893658-03ade452a3-d93f6b2b8b-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Textual Worker取消后怎样处理清理逻辑"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/800_new_0_1.html" class="aLightGray" title="线程">线程</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="/articletag/2436_new_0_1.html" class="aLightGray" title="异步任务">异步任务</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="Worker">Worker</a> <a href="javascript:;" class="aLightGray" title="CancelledError">CancelledError</a> <a href="javascript:;" class="aLightGray" title="Textual">Textual</a> <a href="javascript:;" class="aLightGray" title="线程清理">线程清理</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631482.html" class="aBlack" target="_blank" title="Python Textual Worker取消后怎样处理清理逻辑">Python Textual Worker取消后怎样处理清理逻辑</a> </dt> <dd class="cont2"> <span><i class="view"></i>129浏览</span> <span class="collectBtn user_collection" data-id="631482" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631481.html" class="img_box" title="Python Typer可重复参数怎样收集为列表"> <img src="/uploads/20261013/1791893635-f0f5ddc042-8d8a49485d-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Typer可重复参数怎样收集为列表"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/106_new_0_1.html" class="aLightGray" title="CLI">CLI</a> · <a href="/articletag/301_new_0_1.html" class="aLightGray" title="命令行">命令行</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="javascript:;" class="aLightGray" title="命令行选项">命令行选项</a> <a href="javascript:;" class="aLightGray" title="list[str]">list[str]</a> <a href="javascript:;" class="aLightGray" title="Python Typer">Python Typer</a> <a href="javascript:;" class="aLightGray" title="Typer重复参数">Typer重复参数</a> <a href="javascript:;" class="aLightGray" title="Typer列表参数">Typer列表参数</a> <a href="javascript:;" class="aLightGray" title="list[float]">list[float]</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631481.html" class="aBlack" target="_blank" title="Python Typer可重复参数怎样收集为列表">Python Typer可重复参数怎样收集为列表</a> </dt> <dd class="cont2"> <span><i class="view"></i>157浏览</span> <span class="collectBtn user_collection" data-id="631481" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631480.html" class="img_box" title="Python Textual后台任务怎么把结果送回界面"> <img src="/uploads/20261013/1791893435-ef2a61d1e7-a9702d2d8f-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Textual后台任务怎么把结果送回界面"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="后台任务">后台任务</a> <a href="javascript:;" class="aLightGray" title="Worker">Worker</a> <a href="javascript:;" class="aLightGray" title="Textual">Textual</a> <a href="javascript:;" class="aLightGray" title="post_message">post_message</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631480.html" class="aBlack" target="_blank" title="Python Textual后台任务怎么把结果送回界面">Python Textual后台任务怎么把结果送回界面</a> </dt> <dd class="cont2"> <span><i class="view"></i>317浏览</span> <span class="collectBtn user_collection" data-id="631480" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631479.html" class="img_box" title="Python Polars扫描CSV与读取CSV有什么区别"> <img src="/uploads/20261013/1791893399-0f5a8dce39-b3fc3bfd28-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Polars扫描CSV与读取CSV有什么区别"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/1392_new_0_1.html" class="aLightGray" title="csv">csv</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="/articletag/3145_new_0_1.html" class="aLightGray" title="数据处理">数据处理</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="Polars">Polars</a> <a href="javascript:;" class="aLightGray" title="read_csv">read_csv</a> <a href="javascript:;" class="aLightGray" title="LazyFrame">LazyFrame</a> <a href="javascript:;" class="aLightGray" title="scan_csv">scan_csv</a> <a href="javascript:;" class="aLightGray" title="CSV性能">CSV性能</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631479.html" class="aBlack" target="_blank" title="Python Polars扫描CSV与读取CSV有什么区别">Python Polars扫描CSV与读取CSV有什么区别</a> </dt> <dd class="cont2"> <span><i class="view"></i>407浏览</span> <span class="collectBtn user_collection" data-id="631479" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631478.html" class="img_box" title="Python Polars LazyFrame怎样查看查询计划"> <img src="/uploads/20261013/1791893058-4f58431949-6b104a4b5e-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Polars LazyFrame怎样查看查询计划"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/3578_new_0_1.html" class="aLightGray" title="查询优化">查询优化</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="explain">explain</a> <a href="javascript:;" class="aLightGray" title="查询计划">查询计划</a> <a href="javascript:;" class="aLightGray" title="Polars">Polars</a> <a href="javascript:;" class="aLightGray" title="LazyFrame">LazyFrame</a> <a href="javascript:;" class="aLightGray" title="show_graph">show_graph</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631478.html" class="aBlack" target="_blank" title="Python Polars LazyFrame怎样查看查询计划">Python Polars LazyFrame怎样查看查询计划</a> </dt> <dd class="cont2"> <span><i class="view"></i>421浏览</span> <span class="collectBtn user_collection" data-id="631478" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631477.html" class="img_box" title="Python Pydantic怎样对多个字段实施联合约束"> <img src="/uploads/20261013/1791892938-35391bf770-f50369595f-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Pydantic怎样对多个字段实施联合约束"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="/articletag/852_new_0_1.html" class="aLightGray" title="数据校验">数据校验</a> · <a href="/articletag/2337_new_0_1.html" class="aLightGray" title="python">python</a> · <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="Pydantic">Pydantic</a> <a href="javascript:;" class="aLightGray" title="field_validator">field_validator</a> <a href="javascript:;" class="aLightGray" title="model_validator">model_validator</a> <a href="javascript:;" class="aLightGray" title="联合约束">联合约束</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631477.html" class="aBlack" target="_blank" title="Python Pydantic怎样对多个字段实施联合约束">Python Pydantic怎样对多个字段实施联合约束</a> </dt> <dd class="cont2"> <span><i class="view"></i>210浏览</span> <span class="collectBtn user_collection" data-id="631477" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> <li> <div class="contBox"> <a href="/article/631476.html" class="img_box" title="Python Pydantic字段校验器before与after怎么选择"> <img src="/uploads/20261013/1791892828-c7f8d39db6-660b662d9b-cover-640.webp" onerror="this.src='/assets/images/moren/morentu.png'" alt="Python Pydantic字段校验器before与after怎么选择"> </a> <dl> <dd class="cont1"> <span> <a href="/articlelist/19_new_0_1.html" class="aLightGray" title="文章">文章</a> · <a href="/articlelist/86_new_0_1.html" class="aLightGray" title="python教程">python教程</a>   |  10小时前  |   <a href="javascript:;" class="aLightGray" title="Python">Python</a> <a href="javascript:;" class="aLightGray" title="Pydantic">Pydantic</a> <a href="javascript:;" class="aLightGray" title="After">After</a> <a href="javascript:;" class="aLightGray" title="field_validator">field_validator</a> <a href="javascript:;" class="aLightGray" title="before">before</a> </span> </dd> <dt class="lineOverflow"> <a href="/article/631476.html" class="aBlack" target="_blank" title="Python Pydantic字段校验器before与after怎么选择">Python Pydantic字段校验器before与after怎么选择</a> </dt> <dd class="cont2"> <span><i class="view"></i>469浏览</span> <span class="collectBtn user_collection" data-id="631476" data-type="article" title="收藏"><i class="collect"></i>收藏</span> </dd> </dl> </div> </li> </ul> </div> </div> <div class="mainRight"> <!-- 右侧广告位banner --> <div class="rightContBox" style="margin-top: 0px;"> <div class="rightTit"> <a href="/courselist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">课程推荐</div> </div> <ul class="lessonRecomRList"> <li> <a href="/course/9.html" class="img_box" target="_blank" title="前端进阶之JavaScript设计模式"> <img src="/uploads/20221222/52fd0f23a454c71029c2c72d206ed815.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="前端进阶之JavaScript设计模式"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/9.html" target="_blank" class="aBlack" title="前端进阶之JavaScript设计模式">前端进阶之JavaScript设计模式</a></dt> <dd class="cont1 lineTwoOverflow"> 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。 </dd> <dd class="cont2">543次学习</dd> </dl> </li> <li> <a href="/course/2.html" class="img_box" target="_blank" title="GO语言核心编程课程"> <img src="/uploads/20221221/634ad7404159bfefc6a54a564d437b5f.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="GO语言核心编程课程"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/2.html" target="_blank" class="aBlack" title="GO语言核心编程课程">GO语言核心编程课程</a></dt> <dd class="cont1 lineTwoOverflow"> 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。 </dd> <dd class="cont2">516次学习</dd> </dl> </li> <li> <a href="/course/74.html" class="img_box" target="_blank" title="简单聊聊mysql8与网络通信"> <img src="/uploads/20240103/bad35fe14edbd214bee16f88343ac57c.png" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="简单聊聊mysql8与网络通信"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/74.html" target="_blank" class="aBlack" title="简单聊聊mysql8与网络通信">简单聊聊mysql8与网络通信</a></dt> <dd class="cont1 lineTwoOverflow"> 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让 </dd> <dd class="cont2">500次学习</dd> </dl> </li> <li> <a href="/course/57.html" class="img_box" target="_blank" title="JavaScript正则表达式基础与实战"> <img src="/uploads/20221226/bbe4083bb3cb0dd135fb02c31c3785fb.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="JavaScript正则表达式基础与实战"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/57.html" target="_blank" class="aBlack" title="JavaScript正则表达式基础与实战">JavaScript正则表达式基础与实战</a></dt> <dd class="cont1 lineTwoOverflow"> 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。 </dd> <dd class="cont2">487次学习</dd> </dl> </li> <li> <a href="/course/28.html" class="img_box" target="_blank" title="从零制作响应式网站—Grid布局"> <img src="/uploads/20221223/ac110f88206daeab6c0cf38ebf5fe9ed.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="从零制作响应式网站—Grid布局"> </a> <dl> <dt class="lineTwoOverflow"><a href="/course/28.html" target="_blank" class="aBlack" title="从零制作响应式网站—Grid布局">从零制作响应式网站—Grid布局</a></dt> <dd class="cont1 lineTwoOverflow"> 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。 </dd> <dd class="cont2">485次学习</dd> </dl> </li> </ul> </div> <div class="rightContBox"> <div class="rightTit"> <a href="/ai.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">AI推荐</div> </div> <ul class="lessonRecomRList"> <li> <a href="/ai/13900.html" target="_blank" title="PubMedQA数据集详解:生物医学问答基准、功能与应用指南" class="img_box"> <img src="/uploads/20260908/6a9f83280940e7.65575695.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="PubMedQA数据集详解:生物医学问答基准、功能与应用指南" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13900.html" class="aBlack" target="_blank" title="PubMedQA">PubMedQA</a></dt> <dd class="cont1 lineTwoOverflow"> 深入了解PubMedQA生物医学问答数据集,涵盖其核心功能、使用方法及在临床决策、药物研发等场景的应用,助力提升NLP模型性能。 </dd> <dd class="cont2">465次使用</dd> </dl> </li> <li> <a href="/ai/13899.html" target="_blank" title="H2O EvalGPT:开源LLM大模型评估与排行榜工具" class="img_box"> <img src="/uploads/20260908/17887986376a9ee6adaf3f5.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="H2O EvalGPT:开源LLM大模型评估与排行榜工具" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13899.html" class="aBlack" target="_blank" title="H2O EvalGPT">H2O EvalGPT</a></dt> <dd class="cont1 lineTwoOverflow"> H2O EvalGPT是H2O.ai推出的开源LLM评估平台,提供详细的大模型性能排行榜、行业特定基准测试及A/B测试功能,助您快速选择最适合项目的高性能大语言模型。 </dd> <dd class="cont2">527次使用</dd> </dl> </li> <li> <a href="/ai/13898.html" target="_blank" title="LMArena是什么?伯克利AI模型评估平台使用指南与功能解析" class="img_box"> <img src="/uploads/20260908/6a9f862dbcfec7.27385604.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="LMArena是什么?伯克利AI模型评估平台使用指南与功能解析" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13898.html" class="aBlack" target="_blank" title="LMArena">LMArena</a></dt> <dd class="cont1 lineTwoOverflow"> LMArena是加州大学伯克利分校推出的AI模型匿名评测平台。通过盲测投票机制,用户可对比不同大模型回答并生成实时排行榜,助力开发者优化模型及用户选择最佳AI工具。 </dd> <dd class="cont2">545次使用</dd> </dl> </li> <li> <a href="/ai/13897.html" target="_blank" title="斯坦福HELM:大语言模型Holistic Evaluation整体评估框架详解" class="img_box"> <img src="/uploads/20260908/6a9f86b31ed789.06773114.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="斯坦福HELM:大语言模型Holistic Evaluation整体评估框架详解" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13897.html" class="aBlack" target="_blank" title="HELM">HELM</a></dt> <dd class="cont1 lineTwoOverflow"> 深入了解斯坦福推出的HELM(Holistic Evaluation of Language Models)大模型评测体系。本文解析其核心功能、安装配置步骤及应用场景,涵盖准确性、公平性、鲁棒性等多维度指标,助力开发者全面优化语言模型性能。 </dd> <dd class="cont2">495次使用</dd> </dl> </li> <li> <a href="/ai/13896.html" target="_blank" title="MMBench详解:多模态大模型基准测试、功能特点与使用指南" class="img_box"> <img src="/uploads/20260908/6a9f86d3eed3e7.18564236.jpg" onerror="this.onerror='',this.src='/assets/images/moren/morentu.png'" alt="MMBench详解:多模态大模型基准测试、功能特点与使用指南" style="object-fit:cover;width:100%;height:100%;"> </a> <dl> <dt class="lineTwoOverflow"><a href="/ai/13896.html" class="aBlack" target="_blank" title="MMBench">MMBench</a></dt> <dd class="cont1 lineTwoOverflow"> MMBench是由上海人工智能实验室等机构联合推出的多模态基准测试平台,提供细粒度能力评估、大规模数据集及VLMEvalKit工具。本文详细介绍其核心功能、安装使用方法及应用场景,助力开发者全面评估多模态模型性能。 </dd> <dd class="cont2">314次使用</dd> </dl> </li> </ul> </div> <!-- 相关文章 --> <div class="rightContBox"> <div class="rightTit"> <a href="/articlelist.html" class="more" title="查看更多">查看更多<i class="iconfont"></i></a> <div class="tit lineOverflow">相关文章</div> </div> <ul class="aboutArticleRList"> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/622385.html" class="aBlack" title="Python sqlite3 Connection serialize 怎么导出数据库快照:备份窗口、内存占用与恢复校验">Python sqlite3 Connection serialize 怎么导出数据库快照:备份窗口、内存占用与恢复校验</a></dt> <dd> <span class="left">2026-08-26</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/616032.html" class="aBlack" title="Python监控网页状态:requests异常处理实战">Python监控网页状态:requests异常处理实战</a></dt> <dd> <span class="left">2026-05-29</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/612350.html" class="aBlack" title="TensorFlow模型部署为API的TF Serving方法">TensorFlow模型部署为API的TF Serving方法</a></dt> <dd> <span class="left">2026-05-26</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/602477.html" class="aBlack" title="Python字符串编码转换:encode与decode详解">Python字符串编码转换:encode与decode详解</a></dt> <dd> <span class="left">2026-05-16</span> <span class="right">501浏览</span> </dd> </dl> </li> <li> <dl> <dt class="lineTwoOverflow"><a href="/article/602019.html" class="aBlack" title="TensorFlow裁剪无用算子方法详解">TensorFlow裁剪无用算子方法详解</a></dt> <dd> <span class="left">2026-05-15</span> <span class="right">501浏览</span> </dd> </dl> </li> </ul> </div> </div> </div> <div class="footer"> <div class="footerIn"> <div class="footLeft"> <div class="linkBox"> <a href="/about/1.html" target="_blank" class="aBlack" title="关于我们">关于我们</a> <a href="/about/5.html" target="_blank" class="aBlack" title="免责声明">免责声明</a> <a href="#" class="aBlack" title="意见反馈">意见反馈</a> <a href="/about/2.html" class="aBlack" target="_blank" title="联系我们">联系我们</a> <a href="/send.html" class="aBlack" title="广告合作">内容提交</a> <a href="/manual/go/" target="_blank" class="aBlack" title="手册">手册</a> </div> <div class="footTip">Golang学习网:公益在线Go学习平台,帮助Go学习者快速成长!</div> <div class="shareBox"> <span><i class="qq"></i>技术交流群</span> </div> <div class="copyRight"> Copyright 2023 http://www.17golang.com/ All Rights Reserved | <a href="https://beian.miit.gov.cn/" target="_blank" title="备案">湘ICP备19018815号-4</a> </div> </div> <div class="footRight"> <ul class="encodeList"> <li> <div class="encodeImg"> <img src="/assets/examples/qrcode_for_gh.jpg" alt="Golang学习网"> </div> <div class="tit">关注公众号</div> <div class="tip">Golang学习网</div> </li> <div class="clear"></div> </ul> </div> <div class="clear"></div> </div> </div> <!-- 微信登录弹窗 --> <style> .popupBg .n-error{ color: red; } </style> <div class="popupBg"> <div class="loginBoxBox"> <div class="imgbg"> <img src="/assets/images/leftlogo.jpg" alt=""> </div> <!-- 微信登录 --> <div class="loginInfo encodeLogin" style="display: none;"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="changeLoginType cursorPointer create_wxqrcode" onclick="$('.loginInfo').hide();$('.passwordLogin').show();"> <div class="tip">密码登录在这里</div> </div> <div class="encodeInfo"> <div class="tit"><i></i> 微信扫码登录或注册</div> <div class="encodeImg"> <span id="wx_login_qrcode"><img src="/assets/examples/code.png" alt="二维码"></span> <!-- <div class="refreshBox"> <p>二维码失效</p> <button type="button" class="create_wxqrcode">刷新1111</button> </div> --> </div> <div class="tip">打开微信扫一扫,快速登录/注册</div> </div> <div class="beforeLoginTip">登录即同意 <a href="#" class="aBlue" title="用户协议">用户协议</a> 和 <a href="#" class="aBlue" title="隐私政策">隐私政策</a></div> </div> <!-- 密码登录 --> <div class="loginInfo passwordLogin"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="changeLoginType cursorPointer create_wxqrcode" onclick="$('.loginInfo').hide();$('.encodeLogin').show();"> <div class="tip">微信登录更方便</div> </div> <div class="passwordInfo"> <ul class="logintabs selfTabMenu"> <li class="selfTabItem loginFormLi curr">密码登录</li> <li class="selfTabItem registerFormBox ">注册账号</li> </ul> <div class="selfTabContBox"> <div class="selfTabCont loginFormBox" style="display: block;"> <form name="form" id="login-form" class="form-vertical form" method="POST" action="/index/user/login"> <input type="hidden" name="url" value="//www.17golang.com/article/416236.html"/> <input type="hidden" name="__token__" value="52dc370f30ca681c89ba51d2bc61bb6b" /> <div class="form-group" style="height:70px;"> <input class="form-control" id="account" type="text" name="account" value="" data-rule="required" placeholder="邮箱/用户名" autocomplete="off"> </div> <div class="form-group" style="height:70px;"> <input class="form-control" id="password" type="password" name="password" data-rule="required;password" placeholder="密码" autocomplete="off"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" data-rule="required;length(4)" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <img src="/captcha.html" width="100" height="45" onclick="this.src = '/captcha.html?r=' + Math.random();"/> </span> </div> <div class="other"> <a href="#" class="forgetPwd aGray" onclick="$('.loginInfo').hide();$('.passwordForget').show();" title="忘记密码">忘记密码</a> </div> <div class="loginBtn mt25"> <button type="submit">登录</button> </div> </form> </div> <div class="selfTabCont registerFormBox" style="display: none;"> <form name="form1" id="register-form" class="form-vertical form" method="POST" action="/index/user/register"> <input type="hidden" name="invite_user_id" value="0"/> <input type="hidden" name="url" value="//www.17golang.com/article/416236.html"/> <input type="hidden" name="__token__" value="52dc370f30ca681c89ba51d2bc61bb6b" /> <div class="form-group" style="height:70px;"> <input type="text" name="email" id="email2" data-rule="required;email" class="form-control" placeholder="邮箱"> </div> <div class="form-group" style="height:70px;"> <input type="text" id="username" name="username" data-rule="required;username" class="form-control" placeholder="用户名必须3-30个字符"> </div> <div class="form-group" style="height:70px;"> <input type="password" id="password2" name="password" data-rule="required;password" class="form-control" placeholder="密码必须6-30个字符"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" data-rule="required;length(4)" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <img src="/captcha.html" width="100" height="45" onclick="this.src = '/captcha.html?r=' + Math.random();"/> </span> </div> <div class="loginBtn"> <button type="submit">注册</button> </div> </form> </div> </div> </div> <div class="beforeLoginTip">登录即同意 <a href="https://www.17golang.com/about/3.html" target="_blank" class="aBlue" title="用户协议">用户协议</a> 和 <a href="https://www.17golang.com/about/4.html" target="_blank" class="aBlue" title="隐私政策">隐私政策</a></div> </div> <!-- 重置密码 --> <div class="loginInfo passwordForget"> <div class="closeIcon" onclick="$('.popupBg').hide();"></div> <div class="returnLogin cursorPointer" onclick="$('.passwordForget').hide();$('.passwordLogin').show();">返回登录</div> <div class="passwordInfo"> <ul class="logintabs selfTabMenu"> <li class="selfTabItem">重置密码</li> </ul> <div class="selfTabContBox"> <div class="selfTabCont"> <form id="resetpwd-form" class="form-horizontal form-layer nice-validator n-default n-bootstrap form" method="POST" action="/api/user/resetpwd.html" novalidate="novalidate"> <div style="height:70px;"> <input type="text" class="form-control" id="email" name="email" value="" placeholder="输入邮箱" aria-invalid="true"> </div> <div class="codeBox" style="height:70px;"> <div class="form-group" style="height:70px; width:205px; float: left;"> <input type="text" name="captcha" class="form-control" placeholder="验证码" /> </div> <span class="input-group-btn" style="padding:0;border:none;"> <a href="javascript:;" class="btn btn-primary btn-captcha cursorPointer" style="background: #2080F8; border-radius: 4px; color: #fff; padding: 12px; position: absolute;" data-url="/api/ems/send.html" data-type="email" data-event="resetpwd">发送验证码</a> </span> </div> <input type="password" class="form-control" id="newpassword" name="newpassword" value="" placeholder="请输入6-18位密码"> <div class="loginBtn mt25"> <button type="submit">重置密码</button> </div> </form> </div> </div> </div> </div> </div> </div> <script src="/assets/js/juejin-theme.js?v=20260613b" defer></script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?e34c3e8ab31ba35d7e1c48ea8d77315f"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script src="/assets/js/frontend/common.js"></script> </body> </html>