Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What are the commands that are used to copy an object in Python?

Answer Posted / chaitanya

The command that is used to copy an object in python includes:

• copy.copy() function: This makes a copy of the file from source to destination. It returns a shallow copy of the parameter that is passed.

• copy.deepcopy(): This also creates a copy of the object from source to destination. It returns a deep copy of the parameter that is passed to the function.

The dictionary consists of all the objects and the copy() method which is used as:

newdict = olddict.copy()

The assignment statement doesn’t copy any object but it creates a binding between the target and the object that is used for the mutable items. Copy is required to keep a copy of it using the modules that is provided to give generic and shallow operations.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does serialization mean in python?

845


What is dict in python?

803


How would you implement inheritance in python?

849


How to capitalize the first letter of each word in a string (python)?

863


How do I run Apache in Python?

869


Does Python support Multithreading?

850


What is dogpile effect?

797


How web scraping is done in python, explain in short?

786


Does python have access specifiers?

763


Explain ternary operator in python?

767


What happens if an error occurs that is not handled in the except block?

798


What is super () in react?

833


How to get indices of n maximum values in a numpy array?

798


Please explain when is the python decorator used?

780


What is python mapping?

904