0
在Python 3. *中,是否有一種方法可以通過使用一行來實現相同的結果?Python 3中的一行技巧。*一個循環
feature_combo = [(i,icol) for i,icol in enumerate(keepCols) if icol in features]
feature_id = [i[0] for i in feature_combo]
feat_name = [i[1] for i in feature_combo]
## where keepCols=['a','b','c','d',...,'z']; features = ['b', 'c', ... , 't']
沒錯!非常感謝!!! – rightly0716