应用场景:银行内部所有证明文件要求有备注时间且为大写格式
代码实现
import re,datetime
now_date = datetime.datetime.now()
def get_date_change(now_date):
date_stype = ['0','一','二','三','四','五','六','七','八','九']
num_list = re.findall(r'\d',now_date)
date_name = ''
n = 0
for num in num_list:
if (n == 4 and int(num) > 0) or (n == 6 and int(num) == 0):
print('0月0日不累加')
else:
date_name += date_stype[int(num)]
if n == 3:
date_name += '年'
if n == 5:
date_name += '月'
if n == 4 and int(num) > 0:
date_name += '十'
if n == 6 and int(num) > 0:
date_name += '十'
print(date_name,'222')
n += 1
date_name += '日'
print(date_name,'3333')
return date_name
date_name = get_date_change(now_date)
print(date_name,'444')
可不可以弄一个人民币大小写转换