摘要: python作为动态语言,开发效率相当高,但如我们所知,动态语言的执行效率往往是比较低的,请看下面简单的测试过程:一、 C语言实现100万次打印: 代码:#include<stdio.h>#include <time.h>int main(int argc, char* argv[]){ unsigned long i = 1; unsigned long ulNum = 1000000; clock_t start, finish; double duration; start = clock(); while (ulNum != 0) { printf(" 阅读全文
posted @ 2012-02-19 23:47 Socrates 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 从上学时开始,通常是用C来求阶乘,今天无事,用python写了一下,主要在于学习lambda和reduce这两个函数的使用。实现:#!/usr/bin/env python #-*- coding: utf-8 -*- import time def test_factorial_reduce(): ''' Function:使用reduce函数 Input:NONE Output: NONE author: socrates blog:http://blog.csdn.net/dyx1024 date:2012-02-19 ... 阅读全文
posted @ 2012-02-19 14:33 Socrates 阅读(499) 评论(0) 推荐(1) 编辑
摘要: 本文主要讲解如何使用python来实现将文本转为语音,以一个小例子为例,写了一下用pyTTS来朗读本地方件或在线朗读RFC文档,当然也可以修改一下,做成在线朗读新闻之类的,另本来想实现一个读中文小说的小程序,目前没有发现对中文支持得非常好的,且是免费的语音处理引擎,只能使用TTS实现一个英文的了,就当是用来练习听力了。 1、准备: a. 下载pyTTS,http://sourceforge.net/projects/uncassist/files/pyTTS/pyTTS%203.0/ b. 下载SpeechSDK51:下载 c. 下载SpeechSDK51 patch,支持中文和... 阅读全文
posted @ 2012-02-19 09:00 Socrates 阅读(969) 评论(0) 推荐(0) 编辑