格式化输出用户名/密码
内容来自网络
def get_account(num): accounts = [] for index in range(1, num+1): accounts.append( {"username": "user%s" % index, "password": str(index) * 6}, ) return accounts print get_account(5)
输出:
[{‘username‘: ‘user1‘, ‘password‘: ‘111111‘}, {‘username‘: ‘user2‘, ‘password‘: ‘222222‘}, {‘username‘: ‘user3‘, ‘password‘: ‘333333‘}, {‘username‘: ‘user4‘, ‘password‘: ‘444444‘}, {‘username‘: ‘user5‘, ‘password‘: ‘555555‘}]
原文地址:https://www.cnblogs.com/monogem/p/11367963.html
时间: 2024-11-10 16:19:25