我希望在数组内插入10条数据users_values.append((i, 75, 1, x[j] + '.mp4', str(uuid.uuid1()) + ".mp4", 'abc', '2018-08-01 06:21:37', '2018-08-01 06:21:37', 0, 0))10条数据的样子是变量x[j]从这个数组里面顺序取值 x = ['a', 'b', 'c', 'd', 'e']变量i从828到837取值for i in range(828, 837, 1)我的大致思路是这样的users_values = []
x = ['a', 'b', 'c', 'd', 'e'] for j in x:
(i, 75, 1, x[j] + '.mp4',
str(uuid.uuid1()) + ".mp4", 'abc', '2018-08-01 06:21:37', '2018-08-01 06:21:37', 0, 0) for i in range(828, 837, 1):
(i, 75, 1, x[j] + '.mp4',
str(uuid.uuid1()) + ".mp4", 'abc', '2018-08-01 06:21:37', '2018-08-01 06:21:37', 0, 0)
users_values.append()请问怎么实现
1 回答
梵蒂冈之花
TA贡献1900条经验 获得超5个赞
表述的不是很明白呀,你是想要在 ['a', 'b', 'c', 'd', 'e']
里面循环往复的取值?
import uuidfrom itertools import cycle cs = cycle(['a', 'b', 'c', 'd', 'e']) users_value = []for i in range(828, 838): value = (i, 75, 1, next(cs) + '.mp4', str(uuid.uuid1()) + '.mp4', 'abc', '2018-08-01 06:21:37', '2018-08-01 06:21:37', 0,0) users_value.append(value)
添加回答
举报
0/150
提交
取消