2017年6月28日 to 2017-06-28
2017年10月27日 to 2017-10-27
2017年12月1日 to 2017-12-01
2017年7月1日 to 2017-07-01

#coding=utf-8

def func(string):
    year = string.find(u'')
    month = string.find(u'')
    day = string.find(u'')
    if month-year==2:
        string = string.replace(u"",u"年0")
    if day-month==2:
        string = string.replace(u"",u"月0")
    return string.replace(u"","").replace(u"","-").replace(u"","-")
    
if __name__ == '__main__':
    l1 = u"2017年6月28日"
    l2 = u"2017年10月27日"
    l3 = u"2017年12月1日"
    l4 = u"2017年7月1日"
    print func(l1)
    print func(l2)
    print func(l3)
    print func(l4)

 

相关文章:

  • 2021-10-20
  • 2021-12-10
  • 2021-06-11
  • 2021-08-21
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-11-25
相关资源
相似解决方案