Skip to content

Tag: dictionary

Convert dictionary containing fractions into string

I want to convert a dictionary into a list of strings. Although my actual code is much longer, a MWE is: The output is: If I try the fractions package, it seems I can convert fractions themselves into something suitable but it doesn’t work for dictionaries or arrays: I want to extract all the numerical …

How to store multiple strings in list in Python?

I have this ListOfCoordinates list with 5 tuples (image below), with each index corresponding to the coordinates of two regions of the brain. I also have this variable named brain_areas_ROIs, which is a dictionary (image below) with the names of all possible brain regions. So I want to store in a dictionary t…