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