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