日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

Coursera课程Python for everyone:Quiz: Regular Expressions

發布時間:2025/3/21 python 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Coursera课程Python for everyone:Quiz: Regular Expressions 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Quiz: Regular Expressions

10?試題

1.?

Which of the following best describes "Regular Expressions"?

A way to solve Algebra formulas for the unknown value

A way to calculate mathematical values paying attention to operator precedence

The way Python handles and recovers from errors that would otherwise cause a traceback

A small programming language unto itself

2.?

Which of the following is the way we match the "start of a line" in a regular expression?

^

str.startswith()

\linestart

String.startsWith()

variable[0:1]

3.?

What would the following mean in a regular expression? [a-z0-9]

Match anything but a lowercase letter or digit

Match an entire line as long as it is lowercase letters or digits

Match any text that is surrounded by square braces

Match a lowercase letter or a digit

Match any number of lowercase letters followed by any number of digits

4.?

What is the type of the return value of the re.findall() method?

A boolean

A single character

A list of strings

An integer

A string

5.?

What is the "wild card" character in a regular expression (i.e., the character that matches any character)?

$

+

.

*

?

^

6.?

What is the difference between the "+" and "*" character in regular expressions?

The "+" matches at least one character and the "*" matches zero or more characters

The "+" matches upper case characters and the "*" matches lowercase characters

The "+" matches the beginning of a line and the "*" matches the end of a line

The "+" matches the actual plus character and the "*" matches any character

The "+" indicates "start of extraction" and the "*" indicates the "end of extraction"

7.?

What does the "[0-9]+" match in a regular expression?

Several digits followed by a plus sign

Any number of digits at the beginning of a line

One or more digits

Zero or more digits

Any mathematical expression

8.?

What does the following Python sequence print out?

x = 'From: Using the : character' y = re.findall('^F.+:', x) print y

:

From:

^F.+:

['From: Using the :']

['From:']

9.?

What character do you add to the "+" or "*" to indicate that the match is to be done in a non-greedy manner?

^

?

**

\g

$

++

10.?

Given the following line of text:

From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008

What would the regular expression '\S+?@\S+' match?

stephen.marquard@uct.ac.za

d@u

\@\

From

marquard@uct

總結

以上是生活随笔為你收集整理的Coursera课程Python for everyone:Quiz: Regular Expressions的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。