You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
593 B

2 months ago
import time
def get_local_timestr() -> str:
'''
获取当前时间的格式化字符串%Y-%m-%d %H:%M:%S
:return:
'''
timestamp = time.time()
# 转换为结构化时间对象,再格式化为字符串
struct_time = time.localtime(timestamp) # 本地时区时间‌:ml-citation{ref="3,5" data="citationList"}
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S",struct_time)
return formatted_time
if __name__ =="__main__":
list_text = []
if not list_text:
list_text.append("111")
else:
list_text[0]= "111"
print(list_text)