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相关推荐

  1. Coursera课程Python for everyone:Quiz: Reading Web Data From Python

    Reading Web Data From Python 8 试题 1. Which of the following Python data structures is most similar t ...

  2. Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python

    Many-to-Many Relationships and Python 9 试题

  3. Coursera课程Python for everyone:Quiz: Multi-Table Relational SQL

    Multi-Table Relational SQL 10 试题 1. What is the primary added value of relational databases over fla ...

  4. Coursera课程Python for everyone:Quiz: Single-Table SQL

    Single-Table SQL 11 试题 1. Structured Query Language (SQL) is used to (check all that apply) Delete d ...

  5. Coursera课程Python for everyone:Quiz: Object Oriented Programming

    Object Oriented Programming 11 试题 1. Which came first, the instance or the class? instance class fun ...

  6. Coursera课程Python for everyone:Quiz: REST, JSON, and APIs

    REST, JSON, and APIs 10 试题 1. Who is credited with getting the JSON movement started? Pooja Sankar M ...

  7. Coursera课程Python for everyone:Quiz: eXtensible Markup Language

    eXtensible Markup Language 10 试题 1. What is "serialization" when we are talking about web ...

  8. Coursera课程Python for everyone:Quiz: Networks and Sockets

    Networks and Sockets 10 试题 1. What do we call it when a browser uses the HTTP protocol to load a fil ...

  9. Coursera课程Python for everyone:chapter10

    Chapter 10 Quiz 10 试题 1. What is the difference between a Python tuple and Python list? Lists are mu ...

最新文章

  1. DIY机器人?硬件创新也是潮流
  2. Microbiome:香港理工李向东组-医院源可吸入耐药基因与宿主群落、临床关联和环境风险...
  3. 【技术学习】一次Node.js站点渗透
  4. c盘users的用户名怎么改_iphone备份太大,严重挤占C盘空间怎么办?不用额外软件将备份放在C盘之外的教程...
  5. Android 优秀博客汇总
  6. java中对象的生存期_深入理解Java虚拟机-判断对象是否存活算法与对象引用
  7. 计算机网络怎么寻址_计算机网络中的无类寻址
  8. 那些在11gR2中可能惹祸的新特性,一张列表帮助你摆脱升级11gR2带来的烦恼
  9. 培训ui设计要学编程吗?
  10. 精通语言不等于是一个好的软件开发人员
  11. Java实现二分查找法
  12. iOS中转义后的html标签如何还原
  13. 自动驾驶 9-2: 卡尔曼滤波器和偏置BLUEs Kalman Filter and The Bias BLUEs
  14. matlab数字图像处理实验报告
  15. nginx 配置静态网页
  16. 已解决:jdk版本冲突,nested exception is java.lang.UnsupportedClassVersionError:JVMCFRE003
  17. file.getOriginalFilename()
  18. ret2csu ROP Emporium
  19. 什么是企业微信scrm系统?企业微信SCRM系统有什么功能?企业微信SCRM系统推荐。
  20. mysql反向递归查询_递归查询所有下级部门树形结构反向递归获取所有ID集合

热门文章

  1. The Wide and Deep Learning Model(译文+Tensorlfow源码解析) 原创 2017年11月03日 22:14:47 标签: 深度学习 / 谷歌 / tensorf
  2. “解剖”HIGO徐易容:关于创业、后悔、喝酒和滑雪
  3. 谷歌大脑科学家亲解 LSTM:一个关于“遗忘”与“记忆”的故事
  4. 解读思科2014-19年全球移动互联网发展趋势报告(1)
  5. MySQL-在线处理大表数据 在线修改大表的表结构
  6. 实战SSM_O2O商铺_04自下而上逐步整合SSM
  7. html固定中心,css 两边固定中间自适应布局的实现
  8. html在线压缩tar.gz源码,c50_melp.tar.gz美国2400语音压缩编码算法,文件…
  9. git pull 配置免密_ssh/git pull 无密码登录 自动拉取
  10. mysql 1366in_如何实战解决mysql#1366错误