KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following file names that exhibit this pattern: 000014_L_20111007T084734-20111008T023142.txt 000014_U_20111007T084734-20111008T023142.txt ... I want to extract the middle two time stamp parts after the second underscore '_' and before '.txt' . So I used the following Python regex string split: time_info = re.split('^[0-9]+_[LU]_|-|\.txt$', f) But this gives me two extra empty strings in the returned list: time_info=['', '20111007T084734', '20111008T023142', ''] How do I get only the two time stamp information? i.e. I want: time_info=['20111007T084734', '20111008T023142']
Tags (comma-separated)
Save Edits
Cancel