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的方法非常的简单和快速,所以我把代码分 ...
随机推荐
- WebGIS基础复习笔记
明天要考试了,突击一下. 1.万维网:www是world wide web的简称是在超文本基础上形成的信息网 2.互联网:即广域局域网及单机按照一定的通讯协议组成的国际计算机网络 3.WebGIS:网 ...
- DB Cache Reloaded Fix缓存不能被激活解决方法
1.创建wp-content/plugins/db-cache-reloaded-fix/cache目录. 2.将cache权限改为777. 3.拷贝wp-content/plugins/db-cac ...
- Jquery 获取各种高度、宽度【整理】
alert($(window).height()); //浏览器当前窗口可视区域高度 alert($(document).height()); //浏览器当前窗口文档的高度 alert($(docum ...
- PHP基础入门教程 PHP循环函数
PHP循环主要有四种:while,do…while,for,foreach.下面我们分开讲解每种循环的用法. while语句: 只要指定的条件成立,则循环执行代码块. 格式: while(expr) ...
- Beaglebone Back学习二(功能测试)
开发板测试 买到开发板后,首先要测试一下板子的功能,这个可以参考官方的步骤(Getting Started)进行. 1 首先下载最新的镜像文件http://beagleboard.org/latest ...
- asp.net 运行时, 报控件不存在
Asp.net 运行时,报控件不存在,但系统中确实加入了控件z, 但是生成网站的时候,报控件不存在,输入代码的时候,this.edtxx.Text 确实可以输入 原因: 系统修改的时候,作了一个备份, ...
- EXTJS 4.2 资料 控件之tabpanel 静态生成tabpanel
//**************页面主体开始***************** var tabpanel = Ext.createWidget('tabpanel', { activeTab: 0, ...
- 前端跨域之html5 XMLHttpRequest Level2
前端代码 var xhr=new XMLHttpRequest(); xhr.open('POST','http://127.0.0.1:8081/ceshi',true); xhr.onreadys ...
- android/IOS各平台分享链接/跳转链接配置说明(备用)
Android: [Java] 纯文本查看 复制代码 ? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 微信/朋友圈 //设置 ...
- 基于Vuforia的Hololens图像识别
微软官方Hololens开发文档中有关于Vuforia的内容,https://developer.microsoft.com/en-us/windows/holographic/getting_sta ...