Level 9 : What is the difference between a shallow copy and a deep copy in Python?

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