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

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