python 正则表达式不用取部分

来源:百度知道 编辑:UC知道 时间:2024/04/29 19:04:07
比如说日期2005-06-01把其中的-去掉但是不要用到括号不要分成表不要变成(‘2005’,‘06’,‘01’)而是直接表示出(‘20050601’)有没有这种方法

好像没有,
但是你取时间的时候可以直接去成‘20050601’这种格式的阿。

Directive Meaning Notes
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%I Hour (12-hour clock) as a decimal number [01,12].
%j Day of the year as a decimal number [001,366].
%m Month as a decimal number [01,12].
%M Minute as a decimal number [00,59].
%p Locale's equivalent of either AM or PM. (1)
%S Second as a decimal number [00,61]. (2)
%U Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Sunday are considered to be in week 0. (3)
%w Weekday as a decimal number [0(Sunday),6].