As I already asked on (Convert dictionary key tuple to string), but this time I have a dict={("name1","name2","name3"):256}
I want my dict to be dict={"name1,name2,name3":256} but when I try this I get an error:
new_dct = {}
for k,v in dicts.items():
new_dct[','.join(k)] = v
**TypeError: sequence item 1: expected str instance, float found**
(i removed all nanS) Any idea?
dicts={(1.0, "name1"):256}it would raise that exception (plus or minus the item number), and OP has not shown howdictsgets assigned.dict = {("name1", "name2", "name3"): 256}which is their provided sample input apparently and with it, that error gets raised, that's false, with that input and that code, that error can't be raised, you basically said the same thing in your answer (questionable why it's even an answer, but sure)dicts(notdict), and we're not shown what's indicts.dict, because the code references the variabledictswhose value we are not shown, the exception shown in OP's question is entirely possible.