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 does sort () do in python?
What is __ doc __ in python?
What is python literal?
Is c++ easier than python?
Is javascript better than python?
Explain Python's data types.
What is %s in python?
What does time time () do in python?
What is the script in python?
Does python have enums?
When would you use a break statement in a for loop?
What do u mean by instance?