Categories

May 15, 2019 in Python

Q: Dictionary could be copied to another dictionary using which of following syntax?

dict_a = dict_b

dict_a = dict_b.clear()

dict_a=dict_b.copy()

dict_a = copy(dict_b)

1 Answer

Aug 27, 2019

They copy() statement or method in Python returns a copy of the dictionary.

Syntax of Copy() in Python is as follows:

dict_a=dict_b.copy()

Or

dict.copy()

Parameters:

The copy() method don't have any parameters.

Returns:

This method doesn't modify the original dictionary instead it just returns copy of the dictionary.

Click here to read more about Python
Click here to read more about Insurance

Related questions

Madanswer
Jul 2 in Python
Jul 2 in Python
Jul 10 in Python
...