上一页 1 ··· 4 5 6 7 8
摘要: 3 print(time.time()) # 时间戳:1487130156.419527 4 print(time.strftime("%Y-%m-%d %X")) #格式化的时间字符串:'2017-02-15 11:40:53' # 把一个格式化时间字符串转化为struct_time。实际上它和strftime()是逆操作。 20 print(time.strptime('2011-... 阅读全文
posted @ 2018-08-10 13:30 星牧 阅读(108) 评论(0) 推荐(0) 编辑
摘要: os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作目录;相当于shell下cd os.curdir 返回当前目录: ('.') os.pardir 获取当前目录的父目录字符串名:('..') os.makedirs 阅读全文
posted @ 2018-08-10 13:15 星牧 阅读(104) 评论(0) 推荐(0) 编辑
摘要: lis = [1,3,5,2,7,34]for i in range(len(lis)): for x in range(i): if lis[x] > lis[x+1]: lis[x],lis[x+1] = lis[x+1],lis[x]print(lis) 阅读全文
posted @ 2018-07-27 01:07 星牧 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 练习:用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式 info of Egon Name : Egon Age : 22 Sex : male Job : Teacher end name = input('请输入您的名字>>:')age = input('请输入您的年龄>>:')sex = 阅读全文
posted @ 2018-07-19 14:56 星牧 阅读(205) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8