当前位置:网站首页>Generator parameters incoming parameters
Generator parameters incoming parameters
2022-07-06 08:33:00 【MAR-Sky】
The generator can be send Method to pass in parameters
send function : Pass in parameters to The last time yield End assignment position variable , And execute to the next yield Location
def easy_gen():
print('start...')
m = yield 10
print('mid')
print(m)
n = yield 20
print(n)
print('end')
yield 30
gen = easy_gen() # Get the variable that points to the function
gen.__next__() # return 10
gen.send('adga')
Be careful ,__next__() The method is to yield The next number returns ,
边栏推荐
- Deep learning: derivation of shallow neural networks and deep neural networks
- C language custom type: struct
- 按位逻辑运算符
- Deep analysis of C language data storage in memory
- Analysis of pointer and array written test questions
- Char to leading 0
- Leetcode question brushing (5.28) hash table
- 如何进行接口测试测?有哪些注意事项?保姆级解读
- C语言深度解剖——C语言关键字
- synchronized 解决共享带来的问题
猜你喜欢
[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]
egg. JS project deployment online server
Process of obtaining the electronic version of academic qualifications of xuexin.com
leetcode刷题 (5.28) 哈希表
Circular reference of ES6 module
marathon-envs项目环境配置(强化学习模仿参考动作)
Deep analysis of C language pointer
JVM 快速入门
软件卸载时遇到trying to use is on a network resource that is unavailable
sublime text没关闭其他运行就使用CTRL+b运行另外的程序问题
随机推荐
2022 Inner Mongolia latest construction tower crane (construction special operation) simulation examination question bank and answers
Analysis of pointer and array written test questions
C語言雙指針——經典題型
Visual implementation and inspection of visdom
[2022 广东省赛M] 拉格朗日插值 (多元函数极值 分治NTT)
Restore backup data on S3 compatible storage with tidb lightning
LDAP application (4) Jenkins access
Unified ordering background interface product description Chinese garbled
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Circular reference of ES6 module
egg. JS directory structure
Migrate data from SQL files to tidb
hutool优雅解析URL链接并获取参数
2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
Let the bullets fly for a while
logback1.3. X configuration details and Practice
The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
Cisp-pte practice explanation
JS native implementation shuttle box
sys. argv