Float values as dictionary key

前端 未结 5 766
时光说笑
时光说笑 2020-11-27 21:30

I am developing a class for the analysis of microtiter plates. The samples are described in a separate file and the entries are used for an ordered dictionary. One of the ke

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 22:04

    Another option would be to use tuples:

    dictionary = {(6.8,): 0.3985}
    dictionary[(6.8,)]
    

    Then Retrieving the values later for plotting is easily done with something like

    points = [(pH, value) for (pH,), value in dictionary.items()]
        ...
    

提交回复
热议问题