My task is to verify whether string is valid date and time or not.
\"2013-01-01W23:01:01\"
The date and the time are separated with
If all you need to do is to check whether the string in the format you specified is a valid datetime or not, no need to split it and pass values to some handmade functions, just use this:
from datetime import datetime
try:
valid_datetime = datetime.strptime('2013-01-01W23:01:01', '%Y-%m-%dW%H:%M:%S')
print 'this datetime is valid'
except ValueError:
print 'this datetime is invalid'