Show Time – A Python program written 2 years ago

这是我两年前(2010年07月10日)刚学Python时写的一个程序..
Here’s a Python program I wrote 2 years ago(on July 10th, 2010)..



这图是两年前截的..当时还在用Vista..
The screen shots were taken 2 years ago when I was using Windows Vista..

这是代码:
Here’s how it works:

import time

def TimeStr(num,linenum):
    if num=="1":
        if linenum==1:
            return ' | '
        elif linenum==2:
            return ' | '
        elif linenum==3:
            return ' | '
        elif linenum==4:
            return ' | '
        else:
            return ' | '
    elif num=="2":
        if linenum==1:
            return '___'
        elif linenum==2:
            return '  |'
        elif linenum==3:
            return '---'
        elif linenum==4:
            return '|  '
        else:
            return '---'
    elif num=="3":
        if linenum==1:
            return '___'
        elif linenum==2:
            return '  |'
        elif linenum==3:
            return '---'
        elif linenum==4:
            return '  |'
        else:
            return '---'
    elif num=="4":
        if linenum==1:
            return ' - '
        elif linenum==2:
            return '/| '
        elif linenum==3:
            return '---'
        elif linenum==4:
            return ' | '
        else:
            return ' | '
    elif num=="5":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '|  '
        elif linenum==3:
            return '---'
        elif linenum==4:
            return '  |'
        else:
            return '__|'
    elif num=="6":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '|  '
        elif linenum==3:
            return '|--'
        elif linenum==4:
            return '| |'
        else:
            return '|_|'
    elif num=="7":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '  |'
        elif linenum==3:
            return ' | '
        elif linenum==4:
            return ' | '
        else:
            return ' | '
    elif num=="8":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '| |'
        elif linenum==3:
            return '|-|'
        elif linenum==4:
            return '| |'
        else:
            return '|_|'
    elif num=="9":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '| |'
        elif linenum==3:
            return '--|'
        elif linenum==4:
            return '  |'
        else:
            return '__|'
    elif num=="0":
        if linenum==1:
            return '---'
        elif linenum==2:
            return '| |'
        elif linenum==3:
            return '| |'
        elif linenum==4:
            return '| |'
        else:
            return '|_|'
    else:
        if linenum==1:
            return '   '
        elif linenum==2:
            return ' O '
        elif linenum==3:
            return '   '
        elif linenum==4:
            return ' O '
        else:
            return '   '

STR=""
while 1:
    for a in range(1,6):
        for b in range(0,8):
            NowTime=time.strftime('%X',time.localtime())
            LetterTime=NowTime[b]
            STR=STR+TimeStr(LetterTime,a)+" "
        print STR
        STR=""
    print "n"
    time.sleep(1)
Advertisements

About tangochen

A high school dropout...
This entry was posted in Programming and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s