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