Explain how to copy an object in Python.
Answer / chaitanya
There are two ways in which objects can be copied in python.
Shallow copy & Deep copy.
Shallow copies duplicate as minute as possible whereas Deep copies duplicate everything.
If a is object to be copied then
-copy.copy(a) returns a shallow copy of a.
-copy.deepcopy(a) returns a deep copy of a.
Is This Answer Correct ? | 0 Yes | 0 No |
What are the differences between c and python?
Why does the following behave unexpectedly in python?
How to find bugs or perform static analysis in a python application?
How do I run notepad ++ in python?
Explain python variable scope error?
explain the reduce() function?
What is python api?
Why should I learn python in 2019?
Where python is mostly used?
What module is used to execute linux commands through the python script and give us with one example
Python documentation is called?
What is docstring? How to define it?