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