I have a list, that I wanted to convert to a dictionary.
L = [
is_text,
is_archive,
is_hidden,
is_system_file,
is_xhtml,
is_audio,
is_video,
is_unrecognised
]
Is there any way to do this, can I convert to dictionary like this by program:
{
"is_text": is_text,
"is_archive": is_archive,
"is_hidden" : is_hidden
"is_system_file": is_system_file
"is_xhtml": is_xhtml,
"is_audio": is_audio,
"is_video": is_video,
"is_unrecognised": is_unrecognised
}
Variables are boolean here.
So that I can easily pass this dictionary to my function
def updateFileAttributes(self, file_attributes):
m = models.FileAttributes(**file_attributes)
m.save()