我试图找出存在多少“用户名”。目前有两个,我可以循环users
获得这个,但感觉很笨重。有没有办法获取用户中有多少个用户名?
open('file.yaml', 'r') as f:
file = yaml.safe_load(f)
# count number of usernames in user...?
文件.yaml:
host: "example.com"
timeout: 60
work:
-
processes: 1
users:
-
username: "me"
-
username: "notme"