上一页 1 ··· 40 41 42 43 44
摘要: # _*_ encoding: utf-8 _*_ @author: ty hery 2019/2/18 string = "hello" # %s打印时结果是hello print("string01=%s" % string) # output: string=hello # %2s意思是字符串 阅读全文
posted @ 2020-11-30 17:20 ty1539 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 一,基本概念 Python代码由表达式和语句组成,并由Python解释器负责执行。它们的主要区别是“表达式”是一个值,它的结果一定是一个Python对象。当Python解释器计算它时结果可以是任何对象。例如42,1+2,int(‘123’),range(10)等。 表达式:赋值,是什么,产生结果,表 阅读全文
posted @ 2020-11-23 11:28 ty1539 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1, for循环的方式 for i in range(10): # print(i, end = ' ') for j in range (1,i+1): # print('等待') # print(f'{j}*{i}={str(j*i):1}', end = ' ') print(f'{j}*{i 阅读全文
posted @ 2020-11-21 09:24 ty1539 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 根据状态显示不同的颜色 cop_product_id 是Many2one到peoduct.product上的, categ_id是product.product里面的字段,直接拿来用就可以了 def create_eng_bom(self): if self.cpo_bom_pcb_number: 阅读全文
posted @ 2020-09-06 18:23 ty1539 阅读(130) 评论(0) 推荐(0) 编辑
摘要: -- coding: utf-8 -- d = {'Reference(m)': (-7.22222222222222, 57.222222222222214), 'Vendor': (38.20370370370372, 11.796296296296289), 'Title': (0, 50), 阅读全文
posted @ 2020-08-28 18:24 ty1539 阅读(628) 评论(0) 推荐(0) 编辑
摘要: # 发起post请求:# 1,将Request方法中的method参数赋值成post # yield scrapy.Request(url=url, callback=self.parse, method='post')# 2,FormRequest()可以发起post请求(推荐) # -*- co 阅读全文
posted @ 2020-02-03 20:48 ty1539 阅读(226) 评论(0) 推荐(0) 编辑
摘要: from .models import Book class PublisherSerializer(serializers.Serializer): id = serializers.IntegerField(read_only=True) title = serializers.CharFiel 阅读全文
posted @ 2019-11-21 14:31 ty1539 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 闭包: 内部函数能够访问外部函数的局部变量,这个特性是闭包(Closure)编程的基础 3. 将lambda函数作为其他函数的返回值,返回给调用者。 函数的返回值也可以是函数。例如return lambda x, y: x+y返回一个加法函数。这时,lambda函数实际上是定义在某个函数内部的函数, 阅读全文
posted @ 2019-09-02 09:10 ty1539 阅读(715) 评论(0) 推荐(0) 编辑
摘要: 现在settings.py中,如下插入的最后3行 apps.py的文件,记得提前在settings中insert中加入app名称 在各个app文加下加入stark.py文件,写入想要实现某种功能的代码 阅读全文
posted @ 2019-09-01 23:51 ty1539 阅读(927) 评论(0) 推荐(0) 编辑
摘要: Python strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 str = "00000003210Runoob01230000000"; print str.strip( '0' ); # 去除首尾 阅读全文
posted @ 2019-07-17 13:45 ty1539 阅读(320) 评论(0) 推荐(0) 编辑
上一页 1 ··· 40 41 42 43 44