当前位置:网站首页>实例010:给人看的时间
实例010:给人看的时间
2022-07-05 08:16:00 【懒笑翻】
题目内容
#### 实例010:给人看的时间 # **题目:**暂停一秒输出,并格式化当前时间。
问题分析
还是用到time()函数
%Y Year with century as a decimal number.年 %m Month as a decimal number [01,12].月 %d Day of the month as a decimal number [01,31].日 %H Hour (24-hour clock) as a decimal number [00,23].时 %M Minute as a decimal number [00,59].分 %S Second as a decimal number [00,61].秒 %z Time zone offset from UTC. %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. %I Hour (12-hour clock) as a decimal number [01,12]. %p Locale's equivalent of either AM or PM.
程序
import time
for i in range(4):
print(time.strftime('%H:%M:%S', time.localtime(time.time())))
time.sleep(1)
import time
for i in range(4):
print(time.strftime('%H:%M:%S'))
time.sleep(1)
结果:
边栏推荐
- How to define guid in AMI code
- Talk about the function of magnetic beads in circuits
- Sql Server的存儲過程詳解
- [cloud native | learn kubernetes from scratch] III. kubernetes cluster management tool kubectl
- Why is 1900 not a leap year
- Naming rules for FreeRTOS
- Process communication mode between different hosts -- socket
- Gradle复合构建
- Network port usage
- NTC thermistor application - temperature measurement
猜你喜欢
Shell script basic syntax
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
Step motor generates S-curve upper computer
Hardware 1 -- relationship between gain and magnification
PMSM dead time compensation
List of linked lists
Network communication model -- Network OSI tcp/ip layering
Consul安装
Let's briefly talk about the chips commonly used in mobile phones - OVP chips
Arduino uses nrf24l01+ communication
随机推荐
UEFI development learning 2 - running ovmf in QEMU
Simple design description of MIC circuit of ECM mobile phone
Bluetooth hc-05 pairing process and precautions
DokuWiki deployment notes
【云原生 | 从零开始学Kubernetes】三、Kubernetes集群管理工具kubectl
Detailed explanation of pragma usage
Imx6ull bare metal development learning 2- use C language to light LED indicator
Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
UEFI development learning 6 - creation of protocol
Process communication mode between different hosts -- socket
1-stm32 operation environment construction
Ble encryption details
Anonymous structure in C language
Brief discussion on Buck buck circuit
The firmware of the connected j-link does not support the following memory access
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
[trio basic tutorial 16 from introduction to proficiency] UDP communication test supplement
Hardware 3 -- function of voltage follower
C WinForm [realize the previous and next selection pictures] - practice 7
Reasons for rapid wear of conductive slip rings