Ejemplo n.º 1
0
	msg = u'Nokia Lumia 800当天价格--'	
	for key, value in prices.iteritems():
		logger.debug(key + u":" + value)
		msg += key + u':' + value + u" "
	return msg

def usage():
	print u'python Lumia800.py 输出Lumia800当日价格'
	print u'python Lumia800.py -s 输出Lumia800当日价格并发送短信' 
	print u'python Lumia800.py -h 帮助' 

need_send_message = False	
try:	
	opts, args = getopt.getopt(sys.argv[1:], "sh", ["help"])
except getopt.GetoptError, err:
	# print help information and exit:
	print str(err) # will print something like "option -a not recognized"
	usage()
	sys.exit(2)	
for o,v in opts:
	if o.lower() == '-s':
		need_send_message = True
	if o.lower() in ('-h','--help'):
		usage()
		sys.exit()
		
msg = get_lumia_prices()
print msg
if need_send_message:
	fetionini.fetionINI(msg.encode('gbk'))
Ejemplo n.º 2
0
	return msg

def usage():
	file = sys.argv[0]
	print 'python ' + file + u' 输出结果到当前屏幕' 
	print 'python ' + file + u' -s 输出结果到当前屏幕并发送短信' 
	print 'python ' + file + u' -h 帮助'

def run():
	need_send_message = False	
	try:	
		opts, args = getopt.getopt(sys.argv[1:], "sh", ["help"])
	except getopt.GetoptError, err:
		# print help information and exit:
		print str(err) # will print something like "option -a not recognized"
		usage()
		sys.exit(2)	
	for o,v in opts:
		if o.lower() == '-s':
			need_send_message = True
		if o.lower() in ('-h','--help'):
			usage()
			sys.exit()
	msg = getweather().encode('gbk')
	print msg
	if need_send_message:
		fetionini.fetionINI(msg)
	
if __name__ == '__main__':
	run()
Ejemplo n.º 3
0
def usage():
    file = sys.argv[0]
    print 'python ' + file + u' 输出结果到当前屏幕'
    print 'python ' + file + u' -s 输出结果到当前屏幕并发送短信'
    print 'python ' + file + u' -h 帮助'


def run():
    need_send_message = False
    try:
        opts, args = getopt.getopt(sys.argv[1:], "sh", ["help"])
    except getopt.GetoptError, err:
        # print help information and exit:
        print str(err)  # will print something like "option -a not recognized"
        usage()
        sys.exit(2)
    for o, v in opts:
        if o.lower() == '-s':
            need_send_message = True
        if o.lower() in ('-h', '--help'):
            usage()
            sys.exit()
    msg = getweather().encode('gbk')
    print msg
    if need_send_message:
        fetionini.fetionINI(msg)


if __name__ == '__main__':
    run()