This article describes how to display the clock in the python console. For more information, see
The code is as follows:
#! /Usr/bin/env python
# Coding: UTF-8
#
#
# Show time in console
#
Import sys
Import time
Raws = '''
.--.
|
'--'
.
/|
|
---
---.
---'
'---
---.
--- |
---'
..
'-- |
|
.---
'--.
---'
.---
| --.
'--'
.--.
'|
|
.--.
| -- |
'--'
.--.
'-- |
---'
'''. Strip ()
Numbers = {}
Def init ():
For num in range (10 ):
Numbers [str (num)] = []
Lineno = 0
For line in raws. split ('\ n '):
Line = line. ljust (4)
Arr = []
For char in line:
Arr. append (char )#! = '')
Numbers [str (lineno/5)]. append (arr)
Lineno + = 1
Numbers [':'] = ['',''], ['','', '-', ''], ['',''], ['','', ','-', ''], ['', '', '']
Numbers [''] = [['', ''], ['', ''], ['', '','', ''], ['', ''], ['', '']
Def print_num (digtal ):
Digtal = str (digtal)
Screen = []
For I in range (5 ):
Screen. append ([])
For num in digtal:
For I, linechar in enumerate (numbers [num]):
For char in linechar:
Screen [I]. append (char)
Screen [I]. append ('')
For line in screen:
Print ''. join (line)
Init ()
Def cls ():
Sys. stdout. write ('\ 033 [2J \ 033 [0; 0h ')
Sys. stdout. flush ()
While True:
T = time. strftime ("% H: % M: % S ")
Cls (); print_num (t)
Time. sleep (1)
T = time. strftime ("% H % M % S ")
Cls (); print_num (t)
Time. sleep (1)