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的方法非常的简单和快速,所以我把代码分 ...
随机推荐
- JS与PHP数组操作的不同
JS与PHP数组操作的不同 1.JS 中向数组中添加元素,必须指定下标 2.php中向数组中添加元素,可以不指定下标(追加) 3.JS 中数组元素的下标,是连续 4.PHP中数组元素的下标,可以不连续 ...
- Java实战之04JavaWeb-03会话技术
一.会话技术简介 1.什么是会话,为什么需要会话技术? 会话:从打开一个浏览器,访问某个网站,到关闭这个浏览器的这个过程称为一次会话.http协议是状态的. 2.会话技术的分类 客户端存储技术:Coo ...
- hibernate的id生成策略
欢迎转载,请注明出处http://www.cnblogs.com/shizhongtao/p/3436523.html 一.xml配置方式的id生成 <id name="id" ...
- 使用WebJar管理css、JavaScript文件
Web前端使用了越来越多的JS或CSS,如jQuery, Backbone.js 和Bootstrap.一般情况下,我们是将这些Web资源拷贝到Java的目录下,通过手工进行管理,这种通方式容易导致文 ...
- =====关于swing的一些收集-swing大收集======
一篇经典的 介绍netbeans中swing 应用程序框架的文章 http://blog.csdn.net/tangwing/article/details/5745075 Swing外观框架 Bea ...
- input获取永久焦点
$(function () { $('#test').blur(function () { var that = this; //或者用闭包 setTimeout(function () { $(th ...
- CentOS平台下为Python添加MongoDB支持PyMongo
下载PyMongo [root@leezhen ~]# wget https://pypi.python.org/packages/source/p/pymongo/pymongo-2.6.3.tar ...
- 一个不错的图片滑动展示插件 anythingslider
一个不错的图片http://css-tricks.com/anythingslider-jquery-plugin/ DEMO演示: http://css-tricks.github.io/Anyth ...
- Hibernate 关联 set 和 list 对比
这里考虑的不是hibernate配置文件相关的list和set.而是实际注入的java集合. 1.就单纯java集合的效率对比 list要比set效率高,因为set是把元素存在map的key所在位置上 ...
- CodeBlocks去掉拼写检查
打开: 选择Compiler... 将红框里面的勾都点掉即可!