摘要: # s = 'alskj'# count = 0# for i in s:# count += 1# print(count)'''def my_len(s1): count = 0 for i in s1: count += 1 print(count)s = 'alskj'my_len(s)de 阅读全文
posted @ 2020-04-28 12:08 Daspig 阅读(285) 评论(0) 推荐(0) 编辑
摘要: ''' open内置函数,调用的是操作系统的接口 f1变量:文件句柄,对文件的任何操作都得通过文件句柄进行 encoding:可以不写,默认编码:操作系统的默认编码 windows:gbk linux/mac:utf-8'''''' 1、打开文件 2、操作文件句柄 3、关闭文件'''## read' 阅读全文
posted @ 2020-04-28 12:05 Daspig 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 字典:{} 扩起来,以兼职对形式存储的容器型数据类型键必须是不可变的数据类型值可以是任意类型python3.5之前是无序的,3.6会按照初次建立的顺序排列,3.7以后是有序的优点:查询速度快,存储关联性的数据;缺点:以空间换时间方式一:dict = dict((('one', 1), ('two', 阅读全文
posted @ 2020-04-28 12:02 Daspig 阅读(111) 评论(0) 推荐(0) 编辑
摘要: # li = [100, 'dfl', True, [1, 2, 3]]# print(li[0], type(li[0]))# l1 = li[0:2]# print(l1, type(l1))# l1 = list('asdasdqweczx')# print(l1)'''l1 = ['su', 阅读全文
posted @ 2020-04-28 11:48 Daspig 阅读(351) 评论(0) 推荐(0) 编辑
摘要: # int 主要用于计算,不同进制之间的转换# i = 8# print(i.bit_length())# boor <--> int <--> str''' True 1 False 0 非0即True 0为False'''''' str-->int s1 = 10 int(s1) s1必须是数字 阅读全文
posted @ 2020-04-28 11:45 Daspig 阅读(351) 评论(0) 推荐(0) 编辑
摘要: name = input('your name: ')age = int(input('your age: '))job = input('your job: ')msg = """ info of %s name: %sage: %djob: %s""" % (name, name, age, j 阅读全文
posted @ 2020-04-28 11:39 Daspig 阅读(129) 评论(0) 推荐(0) 编辑
摘要: # while的循环'''while True: print('六月的雨') print('我们不一样') print('梦回还') print('淀粉类') print('三国恋')'''# while的终止'''flag = Truewhile flag: print('六月的雨') print 阅读全文
posted @ 2020-04-28 11:32 Daspig 阅读(116) 评论(0) 推荐(0) 编辑