美文网首页
三分钟热情自学 Python · 第10期 · Python 正

三分钟热情自学 Python · 第10期 · Python 正

作者: 游文影月志 | 来源:发表于2020-08-31 18:29 被阅读0次

    千淘万漉虽辛苦,吹尽狂沙始到金。
    ——刘禹锡

    1. 前言

    在这个生活中处处都是大数据和人工智能的时代,总是能在各种角落看到 Python 的培训广告。我招架不住敌方的猛烈攻势,败下阵来。经过了一分钟的深思熟虑,我决定利用我的三分钟热情进行回击,从零开始自学 Python

    本期要学习的正则表达式颇有些难度,如果要用一个词来形容它,那非人类语言就再恰当不过了。因此本期我就蜻蜓点水式地学习一下,等以后再回过头来好好学习这一块。
    \color{MintCream}{欢迎订阅我的公众号:游文影月志}

    2.

    Regular Expressions

    正则表达式

    A regular expression is a group of characters or symbols which is used to find a specific pattern in a text.

    正则表达式是由字母和符号组成的一组字符,它可以用来从文本中找出符合某种模式的字符串。

    2.1

    Steps to Using Regular Expressions in Python

    在 Python 中使用正则表达式的步骤

    1. Import the regex module with import re.

      使用 import re 引入正则表达式模块。

      In Python, you need to import the re module first to creating a Regex object. Otherwise, you'll get a NameError: name 're' is not defined error message.

    在 Python 中,需要先引入 re 模块才能创建 Regex 对象。否则将会得到报错信息:“NameError: name 're' is not defined error message”。

    相关文章

      网友评论

          本文标题:三分钟热情自学 Python · 第10期 · Python 正

          本文链接:https://www.haomeiwen.com/subject/dxrpsktx.html