HashMap:
Map<String, Object> book = new HashMap<>(); book.put("name", "Hello Eve"); book.put("isbn", 199988); book.put("author", "Tim"); System.out.println(book);
{author=Tim, isbn=199988, name=Hello Eve}
字典:
{5 : 1, 6 : 2,7 : 3 }
{'key1' : [1,"hello,tim","good"],'key2' : "Hello,everybody",'key3' : 13688995658, 'key4' : (136,139,138)} 例:
dict = {'key1' : [1,"hello,tim","good"],'key2' : "Hello,everybody",'key3' : 13688995658, 'key4' : (136,139,138)} for key in dict: if type(dict[key]) == list or type(dict[key]) == tuple: for x in dict[key]: print(x) Jason:
{
“author”: “Tim”,
“isbn”: 199988,
“name”: “Hello Eve”
}