Exemple #1
0
#-----------------------------------------------------------------------------
#- prepare modules                                                           -
#-----------------------------------------------------------------------------

import os
import sys
# append routine path e.g. "olib.py"
sys.path.append('/home/ou/ou/codes/lib/')
import olib as ob

#-----------------------------------------------------------------------------
#- choose a book to read                                                     -
#-----------------------------------------------------------------------------
line = '______________________________________________________________________\n'
cline = ob.color(line,'green','bold')
print(cline)
choices = {}
choices['a'] = "math: Principles of Mathematical Analysis, Rudin 1976"
choices['b'] = "physics: Feynman Lectures on Physics"
choices['c'] = "atmos. science: Atmospheric Science, Wallace 2006"
choices['d'] = "dynamics meteo.: An Introduction to Dynamic Meteorology, Holton 2004"
choices['e'] = 'programming python'
choices['f'] = 'Sage tutorial'
choices['g'] = 'Asymptote tutorial'

loopList = ['y','','yes','Y','yeah']

ob.printDic(choices)
choice = input(ob.color('\n choose: ','green','bold'))
Exemple #2
0
ob.greenLine()
choices = {}
choices['a'] = "ubuntu 命令速查手册, 华容道 2009"
choices['b'] = "python PocketReference, Lutz 2010"
choices['c'] = "Learning Python, Lutz 2009"
choices['d'] = "Vim Quick Reference Card"
choices['e'] = "Programming Python, Lutz 2010"
choices['g'] = '文件索引: index.pdf'
choices['h'] = 'Note in Learning'
choices['j'] = 'Emacs Colors'
choices['k'] = '英汉气象词典'

loopList = ['y','','yes','Y','yeah']

ob.printDic(choices)
choice = raw_input(ob.color('\n choose: ','green','bold'))

#  choose a book 
#-----------------------------------------------------------------------------
workDir = '/home/ou/archive/docs/'
os.chdir(workDir)
if choice == 'a' or choice == '':
    doc = 'swdocs/linux/HuaRongdao2009.pdf'
elif choice == 'b':
    doc = 'books/python/PocketReference_4th.pdf'
elif choice == 'c':
    doc = 'books/python/LearningPython_4th.pdf'
elif choice == 'd':
    doc = 'swdocs/vim/vimqrc.pdf'
elif choice == 'e':
    doc = 'books/python/Programming_4th.pdf'