#! /usr/bin/python
# -*- coding: utf-8 -*-
import urllib,re,unicodedata,string,sys
from time import strftime,localtime
channel={"1":"CCTV-1","2":"CCTV-2","3":"CCTV-3","4":"CCTV-4亚洲",
"5":"CCTV-4欧洲","6":"CCTV-4美洲","7":"CCTV-5","8":"CCTV-6",
"9":"CCTV-7","10":"CCTV-8","11":"CCTV-9","12":"CCTV-10",
"13":"CCTV-11","14":"CCTV-12","15":"CCTV新闻","16":"CCTV少儿",
"17":"CCTV音乐","18":"CCTV_E","19":"CCTV-F","20":"CCTV-高清"}
if __name__=="__main__":
print "@@"
print "@@ 你可以在命令行后输入数字(1-20)来选择频道 "
print "@@ 通过在命令行后键入help获取频道列表"
print "@@"
if len(sys.argv)==1:
Select="8"
else:
if sys.argv[1]=="help":
for i in range(len(channel)):
print "%3d : %11s" % (i+1, channel["%s" % (i+1)]),
if(i%4 == 3):
print ""
sys.exit(0)
if string.atoi(sys.argv[1])>20 or string.atoi(sys.argv[1]) (.+?) (.+?) ",list[0],re.S)
morning=[]
afternoon=[]
listnum=0
for i in range(len(list2)):
i=re.sub(' ','',list2[i])
if string.atoi(i[:2])>=12: #将上午的节目于下午的节目分开
afternoon.append(i)
else:
morning.append(i)
if len(morning)>len(afternoon):
listnum=len(morning)
else:
listnum=len(afternoon)
print "-"*80,
print " "*13+"上午节目"+" "*26+"下午节目"
print " "*14+"========"+" "*26+"========"
for i in range(listnum):
if(i
希望本文所述对大家的Python程序设计有所帮助。
查看更多关于Python获取央视节目单的实现代码的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did89161