123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import datetime #引入datetime模块
- # 获取时间
- str = datetime.datetime.now() #获取当前时间并转化成字符串
- print(str)
- print(datetime.datetime.now())
- a='asdasda'
- result = 'a' in a
- print(result)
- for i in range(1):
- print(i)
- # # 切割
- # # dep = request.GET["dep"].split('--')[0]
- # import math
- # a = " a'a/a,s-d,e#q%i^d&d%"
- # print(a.replace(" ", "").replace("/", "").replace(",", "").replace("-", "").replace("#", "").replace("%", "").replace("'", "").replace("^", "").replace("&", ""))
- #
- # #\r\n
- # #' '
- # #'
- # #--
- #
- #
- # if "asd' ".find("'") >= 0:
- # print('有空格')
- # # print('dada\n,dadad')
- # print('dadaoror \r\n,dadad')
- #
- # a={'the': 958035, 'of': 536684, 'and': 375233, 'one': 371796, 'in': 335503, 'a': 292250, 'to': 285093, 'zero': 235406, 'nine': 224705}
- # b = {}
- # for i,(k,v) in enumerate(a.items()):
- # print({k:v},end="")
- # b[k]=v
- # if i==4:
- # break
- # print(b)
- # import base64
- # # 使用的时候数据必须进行Bytes类型转换
- # # 方法encode()和decode()方法
- # # a = base64.b64encode(b'hello world')
- #
- #
- # # %s 字符串
- # # %d 整形
- # # %c 单字符
- # # %f 浮点数。控制为数 %.2f 保留两位小数
- # # %x 十六进制
- #
- # #打印结果:
- #
- # #
- # # print(str) #输出字符串信息
- #
- # #
- # #
- # # a= '20200219099'
- # #
- # # def monthly_odd(odd):
- # # """
- # # :param odd: 传入单号
- # # odd_old_right:旧单号右边三位数
- # # odd_old_left:旧单号左边8位数
- # # odd_new_right:新单号右边三位数
- # # odd_new:新单号
- # # :return:
- # # """
- # # odd_old = odd
- # # odd_old_right = int(odd_old[8::])+1 #右边三位
- # # odd_old_left = odd_old[0:8] #左边八位
- # # if len(str(odd_old_right))== 1:
- # # odd_new_right = '0'+'0'+str(odd_old_right) #新的右边三位
- # # odd_new = odd_old_left+odd_new_right
- # # return odd_new
- # # if len(str(odd_old_right))== 2:
- # # odd_new_right = '0'+str(odd_old_right)
- # # odd_new = odd_old_left+odd_new_right
- # # return odd_new
- # # if len(str(odd_old_right))== 3:
- # # odd_new_right = str(odd_old_right)
- # # odd_new = odd_old_left+odd_new_right
- # # return odd_new
- # # b = monthly_odd(a)
- # # print(b)
- #
- # def my_sum(n):
- # if n ==1:
- # return 1
- # return n+my_sum(n-1)
- # print(my_sum(3))
- # 1 2 3
- # import datetime
- # a = '2018-10-03 00:55:00'
- # b = datetime.datetime.strptime(a, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d %H:%M:%S')
- # print(b)
- # a = [{'mo':'mo1','qty':'1'},{'mo':'mo2','qty':'2'},{'mo':'mo3','qty':'3'},{'mo':'mo4','qty':'4'},{'mo':'mo5','qty':'5'}]
- # b={}
- # for i in a:
- # b['mo'+str(i['mo'])] = i['mo']
- # b['qty' + str(i['qty'])] = i['qty']
- # print(i)
- # print(b)
- # a = [{"a1":'1',"a2":'2'},{"a1":'1',"a2":'2'},{"a1":'1',"a2":'2'}]
- # print(a[0])
- # a1 = [{"a3":'3',"a4":'4'},{"a3":'3',"a4":'4'}]
- # aa = [{"a5":'5',"a6":'6'}]
- # a2 = {}
- # alist=[]
- # itm = 0
- # for i in range(len(a)):
- # a2.update(a[i])
- # a2.update(a1[i])
- # a.append(a2)
- # print(alist)
- # a = 1.2
- # print(round(a,0))
|