pyhton学习日志
qq_41735391
这个作者很懒,什么都没留下…
展开
-
python的文件操作
python的文件操作 file=open('springboot.txt', 'r',encoding='UTF-8') lines=file.readlines() for lin in lines: print(lin)原创 2020-08-27 21:47:59 · 65 阅读 · 0 评论 -
python的日期操作
python的日期操作 import time #1.获取秒数 print(time.time()) #2.获取当地时间 #未传参数,获取的是当前时间 #传递参数,解析参数 print(time.localtime()) print(time.localtime(1598531899.329266)) #3.获取年月日,构造时间锉 time_col=time.localtime(time.time()) year=time_col.tm_year mon=time_col.tm_mon day=time_c原创 2020-08-27 21:31:58 · 113 阅读 · 0 评论 -
python的集合操作
python的集合操作 #集合框架的学习 #1.列表 使用[] a=['aasa',1123,'asda'] #1.1 获取指定的数据的长度 print(a[:2]) #1.2 访问列表中的值 print(a[1]) #1.3 更新列表 a.append('添加的内容') print(a) #1.4删除列表的元素 del a[:2] print(a) #1.5 列表的长度 print(len(a)) #1.6插入列表 a.insert(0,'插入的内容') print(a) #1.7 list.po原创 2020-08-26 23:20:44 · 101 阅读 · 0 评论 -
python学习--字符串
python学习--字符串 import random import math #对python的字符串的学习 lstr='hello world' #1.字符串的长度 print(len(lstr)) #2.获取字符串的指定几位 print(lstr[:2]) #3.根据索引获取指定位置的字母 print(lstr[math.ceil(random.random()*len(lstr))]) #4.随机数的获取 print(random.random()) #5.字符串的连接 kkk='123456' p原创 2020-08-26 22:38:30 · 143 阅读 · 0 评论 -
python学习日志--简单基础
python学习日志1--简单基础print以及类型转化字符串以及格式化字符字符串方法运算符以及math print以及类型转化 print('hello world') #********** print("*"*10) #变量的使用 price=10 #the price:10 print("the price:"+str(price)) name='moshi' #首字母要大写 flag=True rating=4.9 #moshi True 4.9 print(name+"\t"+str(flag)原创 2020-07-20 12:11:55 · 89 阅读 · 0 评论