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

When would you use a list vs. A tuple vs. A set in python?

975


How do I check whether a file exists without exceptions?

899


what exactly are iterator, iterable, and iteration?

983


What python frameworks do you know?

961


What does making the cpython different from python?

984


What is with open in python?

1088


How do I exit python?

905


How do I convert a number to a string?

1010


What is class used for in python?

1029


How are phon blocks defined?

940


What is speech_recognition? Does this ship with python by default?

956


What do you understand by membership operators in python?

908


What is the output of print str[4: ] if str = ‘ python language’?

924


What is a dictionary in python?

1050


What are the differences in xrange and range?

971