python string 连接test
def strTest():
name = ""
for i in range(10):
name += "hello"
#print name
def strTest2():
nameList = ["hello","hello","hello","hello","hello","hello","hello","hello","hello","hello"]
name = "".join(nameList)
#print name
if __name__ == "__main__":
import timeit
t = timeit.Timer("strTest()","from __main__ import strTest")
t2 = timeit.Timer("strTest2()","from __main__ import strTest2")
print t.timeit()
print t2.timeit()
python string 连接test的更多相关文章
- python string
string比较连接 >>> s1="python string" >>> len(s) 13 >>> s2=" p ...
- Python string interning原理
原文链接:The internals of Python string interning 由于本人能力有限,如有翻译出错的,望指明. 这篇文章是讲Python string interning是如何 ...
- 【Azure Developer】使用 Python SDK连接Azure Storage Account, 计算Blob大小代码示例
问题描述 在微软云环境中,使用python SDK连接存储账号(Storage Account)需要计算Blob大小?虽然Azure提供了一个专用工具Azure Storage Explorer可以统 ...
- 关于python字符串连接的操作
python字符串连接的N种方式 注:本文转自http://www.cnblogs.com/dream397/p/3925436.html 这是一篇不错的文章 故转 python中有很多字符串连接方式 ...
- python string module
String模块中的常量 >>> import string >>> string.digits ' >>> string.letters 'ab ...
- python 字符串连接
字符串连接 方法1: 用字符串的join方法 a = ['a','b','c','d']content = ''content = ''.join(a)print content 方法2: 用字符串的 ...
- The internals of Python string interning
JUNE 28TH, 2014Tweet This article describes how Python string interning works in CPython 2.7.7. A fe ...
- Python string objects implementation
http://www.laurentluce.com/posts/python-string-objects-implementation/ Python string objects impleme ...
- 使用Python编程语言连接MySQL数据库代码
使用Python编程语言连接MySQL数据库代码,跟大家分享一下: 前几天我用python操作了mysql的数据库,发现非常的有趣,而且python操作mysql的方法非常的简单和快速,所以我把代码分 ...
随机推荐
- Java多线程(四) 线程池
一个优秀的软件不会随意的创建.销毁线程,因为创建和销毁线程需要耗费大量的CPU时间以及需要和内存做出大量的交互.因此JDK5提出了使用线程池,让程序员把更多的精力放在业务逻辑上面,弱化对线程的开闭管理 ...
- 编译安装php Cannot find MySQL header files under /usr/include/mysql.
编译php-5.5-6的mysql支持,出现Cannot find MySQL header files under /usr/include/mysql. Note that the MySQL c ...
- RHEL 6.5升级GCC 4.9.3
前提:保证旧版的gcc,g++存在! root用户 1. 下载源码和依赖包源码:新建目录bakwget http://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.t ...
- 类似FirePhp的Chrome.php 调试php
之前一直用firephp来调试php,主要受限Firefox启动太慢,研究了下chromephp; 写了个简单的判断模版: <?php /** * @Author: Klaus * @Date: ...
- php curl基本操作
如何使用cURL的基本方法?首先,修改php.ini文件的设置,找到php_curl.dll,取消下在的注释extension=php_curl.dll,因为php默认是不开启cURL的. cURL是 ...
- (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法
总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中 ...
- Python学习笔记2——模块的发布
1.为模块nester创建文件夹nester,其中包含:nester.py(模块文件): """这是"nester.py"模块,提供了一个名为prin ...
- Oracle修改表空间大小
在向orale数据库导入数据的时候报 ORA-01658: 无法为表空间 XXX中的段创建 INITIAL 区错误. Oracle我在创建表空间的时候初始化大小为200M,当数据库中数据量达到这个值, ...
- PHP视频教程 > PHP面向对象编程视频教程
当前位置: 主页 > 编程开发 > PHP视频教程 > PHP面向对象编程视频教程 > kingstone金士顿手机内存卡16G仅65元 1.1.什么是面向对象和类 上传日期: ...
- django开发框架-view & template
django框架的主要模型是MVT,Model模型,View视图,Template模板,基于基本的HttpRequest方式. django支持的数据库有四种:PostgreSQL,MySQL, Or ...