fork download
  1. import os
  2. s = "20200702_abcd_ef_aed_usd_cdee_hgd.csv"
  3. print( os.path.splitext(s)[0].split('_', 1)[-1] )
  4.  
  5. import re
  6. print( re.sub(r'^\d+_|\.[^.]*$', '', s) )
Success #stdin #stdout 0.02s 9340KB
stdin
Standard input is empty
stdout
abcd_ef_aed_usd_cdee_hgd
abcd_ef_aed_usd_cdee_hgd