GIAC Python Coder (GPYC) — Question 26

Which of the following import statements will add the ability to parse data with regular expressions to your script?

Answer options

Correct answer: B

Explanation

The correct answer is B, as 'import re' directly imports the regular expression module in Python, allowing you to use its functions. Option A is incorrect because it attempts to import 're' from a non-existent 'regex' module. Option C incorrectly tries to import 'regex' from 're', which is not how the modules are structured. Option D imports 'regex', which is not the standard module for regular expressions in Python.