我希望在數(shù)組內(nèi)插入10條數(shù)據(jù)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條數(shù)據(jù)的樣子是變量x[j]從這個數(shù)組里面順序取值 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()請問怎么實現(xiàn)
1 回答

梵蒂岡之花
TA貢獻(xiàn)1900條經(jīng)驗 獲得超5個贊
表述的不是很明白呀,你是想要在 ['a', 'b', 'c', 'd', 'e']
里面循環(huán)往復(fù)的取值?
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
提交
取消