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