Skip to content
Advertisement

Tag: dictionary

How do i remove a specific json value in python?

I’m making a playlist website that can create display and delete playlists and songs. I’m using a JSON file to store the data. The only feature that isn’t working is the delete song feature. This is my JSON file I’m using the ID of the playlist and the index of the song to locate it in the list and using

Python List to Dictionary from a file

I have a file of notes that im trying to convert to a dictionary. I got the script working but failed to output the data im looking for when there are repeated values. In short took the file commands or comments which are separated by # as per below. I take that list and seperate the 1st column “key” by

How to add aliases to an input dictionary?

Recently I started a project. My goal was it to have a script, which, once launched, could be able to control actions on the hosts computer if an instruction was send via email. (I wanted this so I could start tasks which take a long time to complete while I’m away from home) I started programming and not long after

How to create dictionary from multiple dataframes?

I have a folder with several csv files. Example of the dataframes from csv files in directory: I need to make a function that accepts route to file directory and return sites frequency dictionary (one for all sites in file directory) with unique sites names the following kind: {‘site_string’: [site_id, site_freq]} For our examle it will be: {‘vk.com’: (1, 2),

Assigning dict to class variable converts it to tuple

I’ve been using python for a while and I’ve never run into this. I am passing a dict to a class and assigning it to a class variable like so. If I print the type of rule_list prior to assigning it to self.rule_list I get <class ‘dict’>. Immedietly after assignment, I get <class ‘tuple’>. I want to keep rule_list as

Advertisement