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