上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: #全局变量作用于全局或整个程序中,程序执行完毕后销毁,局部变量作用在当前函数中,调用函数执行完毕及销毁 #对于可变对象的修改,前面在python类型里的可变类型 list dict set 阅读全文
posted @ 2019-06-04 14:13 coldplaycode 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #进入终端窗口,root命令提示符#,普通用户登陆提示符$,切换终端用户 ctrl+shift+F2,退出终端命令exit #init 0 关机 reboot 重启 ls查看当前目录下文件 ls -a 查看所有文件包括隐藏文件 ll -l 查看文件详细信息 #who am i 显示当前登陆用户 da 阅读全文
posted @ 2019-06-04 08:20 coldplaycode 阅读(141) 评论(0) 推荐(0) 编辑
摘要: #python中函数的定义:函数是逻辑结构化和过程化的一种编程方法,用来实现某些特定的功能.#python中函数简单定义的方法# def test(x):# "this is new function"# x+=1# return x#def:定义函数的关键字#test函数名#():括号内可定义形参 阅读全文
posted @ 2019-06-04 07:46 coldplaycode 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #format拼接字符串,format()内的参数必须为可迭代的对象p1="i am {2},age {1},{0}".format("seven",18,'alex') print(tp1) tp1="i am {1},age {1}".format("seven",18,'alex')#按照元祖下标取值 print(tp1) tp1="i am {name},age {age},r... 阅读全文
posted @ 2019-06-03 07:47 coldplaycode 阅读(344) 评论(0) 推荐(0) 编辑
摘要: msg="I am "+"king" print(msg) print("I am %s of the %s" % ("tang","king"))#%s 字符串占位符 print("I am %s of age %s" % ("tang",[20,11]))#%s 字符串占位符 print("I am %s of the %d" % ("tang",1))#%d 整型占位符 #打印浮... 阅读全文
posted @ 2019-06-03 07:36 coldplaycode 阅读(115) 评论(0) 推荐(0) 编辑
摘要: #1.不同元素组成#2.无序#3.集合中的元素必须为不可变类型a={1,2,3,4,5,(1,2,3)}print(a)#随机向集合添加元素a.add("sjsj")print(id(a))#随机删除集合元素a.pop()print(id(a))#清空# a.clear()# print(a)#拷贝 阅读全文
posted @ 2019-06-02 23:51 coldplaycode 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #字典#dict#基本结构info={ "k1":'v1' #键值对 ,"k2":"v2"}#字典的value可以是任何值# info={"k1":18,# 'k2':True,# 'k3':[11,22,55,{"kk1":'vv1',# 'kk2':'vv2',# 'kk3':(11,33,55 阅读全文
posted @ 2019-06-02 23:49 coldplaycode 阅读(178) 评论(0) 推荐(0) 编辑
摘要: #元组,元素不可被修改,不能被增加或者删除 #tuple,有序 tu=(11,22,33,44,55,33) #count 获取指定元素在元祖中出现的次数 print(tu.count(33)) #index获取元素的下标值,可以设置起始和结束位置 print(tu.index(33,3,8)) tu=(1,2,3,3,(455,666,888,),({"11":22,"name":"... 阅读全文
posted @ 2019-06-02 23:46 coldplaycode 阅读(337) 评论(0) 推荐(0) 编辑
摘要: #扩展原来的列表,参数是可迭代对象 阅读全文
posted @ 2019-06-02 23:35 coldplaycode 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 整型 int python3里,不管数字多大都是int类型 python2里面有长整型long 将整型字符串转换为数字 需要注意如果是浮点型的数字字符串,不能用int类型强制转换,而需要用float浮点类型 #当前数字的二进制位,至少用n位表示 #字符串类型的常见内置函数用法 字符串类型常用内置方法 阅读全文
posted @ 2019-06-01 11:43 coldplaycode 阅读(220) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页

coldplaycode