Level 10 : What is the output of the following code?


import re
num = '(212)-123-1234'
pattern = '\D'
result = re.sub(pattern, '',num)
print(result)

Author: anusha | Tags: regular-expression | 1736+ Python FAQs | Share
while-and-for-loop | else-statement | built-in | match | syntax-error | turtle | id-function | factorial-function | max-min | mutable | inheritance | threading | mathematical-function | list-vs-tuple | __init_subclass__ | collections | class-and-inheritance | decorator | string-method | lambda-function | version | print | bitwise-operator | higher-order-function | enumerate() | staticmethod | default-mutable-argument | frozenset | destructor | bitwise | comprehension | encoding | round-function | zfill-function | function-and-scope | asyncio | classes | syntaxerror | function | conditional-statement | list-comprehension | exception-handling | indentation | string-manipulation | type_conversion | global-keyword | while-loop | conversion | built-in-function | string-formatting | fabs-function | version-check | list-comprehension | file-handling | debugging | loops | generators | zip | integer | package-management | loop-control | feature | binary-operation | min-max-function | counter-function | methods | access-modifier | __all__-attribute | numeric | __future__ | identity-operator | choice | math-copysign | data-type | python-django | module | while-else-loop | sorting | scientific-notation | list-operation | boolean | error | library | overflow | syntax-error | operators | precedence-and-associativity | boolean-and-non-boolean | python_version | oop | raise | arithmetic-operation | deep-copy | input | join | generator | postfix | def | immutable-data-type | assert | application | loop | rollback | python | memory-management | polymorphism | matplotlib | implementation | object-attribute | filter-function | for | odd-number | lists | magic-method | sys | min-function | dictionary | complex-number | python-history | with-statement | error-handling | touples | class | string-method | datetime | operations | generators-in-python | asyncio-module | docstring | python-repl | math | heap-memory | command-line-parsing | yield | filter | escape-operator | comment | collection | split | string-slicing | exponentiation | objects | basic | file_handling | slicing | virtual-environment | async | method | mysql | memory | namedtuple | control-statement | string-slicing | typeerror | encapsulation | class-and-object | installation | inherit | dictionaries | global-variable | data-structure | nested-loop | bitwise-operator | keyword | global-variable | file | sorted | return-statement | multiple-inheritance | interpreter | logical-operator | round | exception | center | parameter | array | sum-function | function-argument | logical-operator | slice | operator-overloading | identifier | sum() | immutability | floating-point-precision | append | head-and-tail | set-operation | pseudocode | attribute | list-mutation | string-concatenation | map-function | pickling-&-unpickling | input-function | goto-function | statement | tuple-unpacking | condition | context-manager | invalid-list | expand-tab | matrix | string-iteration | functional-programming | name-mangling | expression | comparison | decimal | data-structure | virtual-environment | format | iterable | multithreading | update | random-function | operand | data-structures | operator-and | call | design-principle | datatype | list-method | list-indexing | sys-module | swapping | mapping-function | pandas | static-method | software-design | built-in-function | data-type | complex | tuple | set | gil | control-flow | copy | operator | precedence | recursion | compute | pep | namespace | thread | list | import-method | input-function | list-slicing | constructor | string | type-conversion | conditional-statement | file-handling | mathematics | logical-operation | counter | range | variable | benefit | recurssion | global | multiprocessing | formal-and-actual-parameter | list-join | iterator | lambda | control-flow | stack | binary | descriptors | shallow-copy | exception-handling | type-conversion | zip-function | class-and-instance-variable | python-module | print-statement | matrix-list-comprehension | syntax | regular-expression | identity-operator | dicts | string-formatting | lambdas | data_structure | arithmetic-expression | indexing | regex | int | operator-or | numpy | random | oops | init | functions | assignment-operator ...