I have the list that contains some items like:
"GFS01_06-13-2017 05-10-18-38.csv" "Metadata_GFS01_06-13-2017 05-10-18-38.csv"
How to find the list item that start with
In SQL I use query:
select item from list where item like 'GFS01_%'
You should try something like this :
[item for item in my_list if item.startswith('GFS01_')]
where “my_list” is your list of items.
If you really want the string output like this “GFS01_06-13-2017 05-10-18-38.csv”,”GFS01_xxx-xx-xx.csv”, you could try this:
', '.join([item for item in myList if item.startswith('GFS01_')])
Or with quotes
', '.join(['"%s"' % item for item in myList if item.startswith('GFS01_')])
Filtering of list will gives you list again and that needs to be handled as per you requirement then.