[Tutor] Add rownumber to list of .arff files

David Hutto smokefloat at gmail.com
Sat Jan 15 22:50:20 CET 2011


>>> filename = ['file1','file2','file3']
>>> fileprefix = 'TRE_'
>>> for item in filename: print('%s%s'%(fileprefix,item))
...
TRE_file1
TRE_file2
TRE_file3

or with list comp

>>> combined = [('%s%s'%(fileprefix,item)) for item in filename]
>>> combined
['TRE_file1', 'TRE_file2', 'TRE_file3']
>>>


More information about the Tutor mailing list