如何使用迭代循环创建如下所示的列表?
col_head =['mfcc_delta_1', 'mfcc_delta_2', 'mfcc_delta_3']
到目前为止,我一直在尝试这种迭代。但这是不正确的。
['mfcc_delta_{%d}'.format(i) for i in range(0,13)]
最佳答案
你可以简单地做
col_head =['mfcc_delta_{}'.format(num) for num in range(13)]
关于python - 如何创建一个字符串列表,其中只有最后一个元素不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48642092/