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

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