我该如何转换元组列表,如:
query_res = [('a3','b6','c1'),
('a3','b6','c2'),
('a3','b6','c3'),
('a3','b7','c4'),
('a4','b8','c5'),
('a4','b8','c6')]
Run Code Online (Sandbox Code Playgroud)
像这样的字典:
result = {
'a3': {
'b6': ['c1', 'c2', 'c3'],
'b7': ['c4']
},
'a4': {
'b8': ['c5', 'c6']
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了defaultdict,错误只能获取内部dict,如何映射a到res此处?:
res = defaultdict(list)
for a, b, c in query_res:
res[b].append(c)
Run Code Online (Sandbox Code Playgroud) wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.0/src/deploy/recommended/kubernetes-dashboard.yaml`
kubectl create -f kubernetes-dashboard.yaml
kubectl create -f kubernetes-dashboard-admin.rbac.yaml
Run Code Online (Sandbox Code Playgroud)
Then setup kubectl proxy, using http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ as recommended.
When I am trying to login using kubernetes-dashboard-admin token. Token was received by using the command:
kubectl -n kube-system get secret | grep -i dashboard-admin | awk '{print $1}' | xargs -I {}
kubectl -n kube-system describe secret {}
Run Code Online (Sandbox Code Playgroud)
Here comes my problem: I CANT access the dashboard via token, …