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]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments