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

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