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 |
Does python have a ternary conditional operator?
What is iterable python?
How can I learn python?
Explain delegation in python
What is special about python?
How will you merge two dictionaries in python?
What is a raw input in python?
What is a for loop in python?
What is py checker in python?
How can you get the google cache age of any url or web page?
How would you convert a string into an int in python?
Is there a difference between `==` and `is` in python?