I have below filename:
pagecounts-20150802-000000
I want to extract the date out of above 20150802
I am using the below code but its not working:
print os.path.splitext("pagecounts-20150802-000000")[0]
The methods in os.path
are mainly used for path string manipulation. You want to use string splitting:
print 'pagecounts-20150802-000000'.split('-')[1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With