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