字符串和字典之間的轉換

字典(dict)類型轉爲字符串(string)類型。   函數 經過遍歷dict中的全部元素就能夠實現字典到字符串的轉換:    spa for key, value in sample_dic.items():      字符串     print "\"%s\":\"%s\"" % (key, value)    string print能夠換成join函數。it 字符串(string)轉爲字
相關文章
相關標籤/搜索