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 |
Explain join() and split() in python.
What should I make with python?
What does len () mean in python?
Do arrays start at 0 in python?
Is there a tool to help find bugs or perform static analysis?
Can you use bootstrap with python?
How to convert strings into integers in python?
What is Python's Purpose?
Why do we use uuid?
Why we are using a python dictionary?
What is numpy array?
Can dictionary have a duplicate keys ?