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


import re

aa = "The rain in Spain"
x = re.sub("\s", "3", aa)
print(x)

Author: anusha | Tags: regular-expression | 1859+ Python FAQs | Share
integers | matrix-list-comprehension | formal-and-actual-parameter | descriptors | boolean-masking | error-handling | arithmetic-expression | boolean-and-non-boolean | advanced-file-operations | indentation | attribute | global | import-method | command-line-parsing | directory-operations | encoding | context-manager | conditional-statement | identifier | control-statement | difference-between-threads-and-processes | list-comprehensions | keyword | recurssion | data-types | filter | frozenset | input | function-argument | compute | init | creating-custom-modules | variable | id-function | type_conversion | with-statement | walking-through-directories-using-os.walk() | thread-synchronization | using-yield-in-functions | type-conversion | zfill-function | update | why-use-multiprocessing-over-threading?-(gil) | exception | sorted | while-else-loop | string-slicing | collections | rollback | syntaxerror | yield | round | arbitrary-arguments-(*args,-**kwargs) | software-design | invalid-list | defining-functions | goto-function | version-check | type-conversion-and-casting | async | function-and-scope | arithmetic-operation | exception-handling | lambda-functions | immutability | identity-operators-(is,-is-not) | generators-in-python | while-and-for-loop | filtering-and-indexing | while-loop | using-map()-for-transformations | oop | conversion | time-series-with-pandas | numeric | generator | comprehension | pandas | list-mutation | def | int | unit-testing | turtle | package-management | namespace | list-comprehension | precedence-and-associativity | min-function | string | tuple-methods | datatype | map-function | operand | min-max-function | higher-order-function | methods | conditional-statements | data-structure | overriding-methods | magic-method | data-structure | touples | deep-copy | logical-operator | global-variable | objects | matrix | formatting-with-strftime | append | regular-expression | copy | test-discovery | docstring | using-assertions-(assertequal,-assertraises) | typeerror | class-and-object | list-comprehension | gil | static-method | assignment-operator | integer | binary-operation | benefit | built-in | string-method | memory-management | loop | python-syntax-and-structure | identity-operator | functions | heap-memory | memory | math | input-function | print-statement | virtual-environment | exponentiation | data-structures-in-python | parsing-with-strptime | python-history | sorting | anchors-(^,-$) | inherit | list-operation | mathematical-function | python-module | file_handling | multiple-inheritance | head-and-tail | error | operators | function | object-attribute | iterators | data-structures | default-mutable-argument | handling-missing-values-(fillna,-dropna) | list-indexing | format | file-handling | return-statement | string-manipulation | list-methods-and-slicing | class-and-inheritance | max-min | application | dictionary-methods | complex-number | tuple-unpacking | design-principle | multiple-except-blocks | tuples | python-operators | zip-function | boolean | threading | split | installation | range | list-method | swapping | raise-statement | logical-operation | shallow-copy | conditional-statement | dictionary | mapping-function | filter-function | key-value-pairs | match | python_version | call | operator-or | bitwise | encapsulation | __init_subclass__ | string-method | exception-handling | lambda | basic | method | operator | mathematics | library | polymorphism | writing:-write(),-writelines() | reading-and-writing-files | while-loops | asyncio | functional-programming | string-slicing | list | statement | multiprocessing | python-repl | implementation | else-statement | matplotlib | loops | sys | mutable | iterator | syntax-error | join | dictionaries | sum-function | escape-operator | data-type | factorial-function | list-join | class | enumerate() | __future__ | intering | nested-loop | access-modifier | lambda-function | membership-operators-(in,-not-in) | comment | operations | using-os-and-pathlib-modules | overflow | debugging | tuple | logical-operator | constructor | using-lists-as-stacks | input-function | comparison | slice | string-methods | else | mysql | dataframe-and-series-objects | type-conversion | bitwise-operator | pseudocode | indexing | operator-overloading | assignment-operators | generators | built-in-modules | fabs-function | floats | string-formatting | random | postfix | file-handling | math-copysign | datetime | python-django | loop-control | functional-programming | data-type-conversions | global-variable | sorting-and-ranking | sum() | loop-control-statements | virtual-environment | string-concatenation | immutable-data-type | lists | expression | list-slicing | recursion | control-flow | sets | identity-operator | for | quantifiers-(*,-+,-?,-{}) | name-mangling | multiple-inheritance | binary | zip | list,-set,-and-dictionary-comprehensions | interpreter | built-in-function | reading:-read(),-readline(),-readlines() | expand-tab | feature | error-handling | destructor | python | reading-and-writing-large-files-efficiently | lambdas | strings | asyncio-module | class-decorators | literal-characters-and-special-characters | odd-number | file | random-function | inheritance | array | working-with-temporary-files-using-tempfile | built-in-function | method-overloading | dicts | collection | floating-point-precision | using-else-and-finally | introduction-to-multiprocessing | namedtuple | __all__-attribute | classes | numpy | using-the-threading-module | introduction-to-threads | data_structure | joining-and-merging-dataframes | working-with-binary-files-(rb,-wb) | syntax | thread | pickling--unpickling | using-join()-and-is_alive()-methods | center | introduction-to-python | assert | list-vs-tuple | print | multithreading | regex | sys-module | working-with-dates-and-times | syntax-error | indexing:-loc-vs-iloc | complex | precedence | iterable | string-formatting | string-iteration | scientific-notation | thread-safe-data-structures-(queue.queue) | choice | opening-files-(open()) | pep | stack | pass | version | raise | set-operation | global-keyword | aggregating-data-with-functools.reduce() | data-type | default-arguments | decorator | creating-and-starting-threads | logical-operators | single-inheritance | managing-directories-with-os-and-shutil | condition | regular-expressions | bitwise-operator | parameter | control-flow | dictionary-comprehensions | class-and-instance-variable | set | slicing | round-function | decimal | counter-function | staticmethod | oops | operator-and | working-with-file-paths | datetime.date,-datetime.time,-datetime.datetime | module | booleans | counter ...