python
剑弑九幽L
在校学生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python基础(一)
hello worldprint("hello python")支持中文#coding=utf-8print("中文")变量python中的变量类型是运行时动态解析,所以不需要预先定义。 在python中,基本的变量类型有一下几种#coding=utf-8a=47b=12.02#python中bool类型False和True开头字母需要大写c=Falsed=True#字符串可以用单引原创 2016-11-03 21:34:25 · 280 阅读 · 0 评论 -
用*号搭建一个金字塔(python实现)
如图 * * * * * * * * * * * * * * * * * * * * * * * * * 代码如下#coding=utf-8#raw代表要画的行数raw=5n=0m=rawwhile n<(raw*2): #画空格 w=m while w>0: print " ",原创 2016-11-03 23:22:33 · 13447 阅读 · 2 评论 -
python 字符串常用操作
#coding=utf-8str1=" dafhgfshhk lfhgj hhs dhfs "len(str1)#计算长度,当有中文时需要显示转换为utf-8编码,否则计算的结果会有误差str2="中文"len(str2) #结果是 6#将字符串显示转换为utf-8str3=str2.decode("utf-8")len(str3) #结果为 2str3=u"中文" #在字符串原创 2016-11-04 14:43:47 · 376 阅读 · 0 评论
分享