Level 1 : What will be the output of the following Python code?


import re
s = 'abc123 xyz666 lmn-11 def77'
re.sub(r'\b([a-z]+)(\d+)', r'\2\1:', s)

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