Is there any function in python similar to dput() function in R?
There are several options for serializing Python objects to files:
json.dump() stores the data in JSON format. It is very read- and editable, but can only store lists, dicts, strings, numbers, booleans, so no compound objects. You need to import json before to make the json module available.pickle.dump() can store most objects.Less common:
shelve module stores multiple Python objects in a DBM database, mostly acting like a persistent dict.marshal.dump(): Not sure when you'd ever need that.