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