当前位置:网站首页>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 ,
边栏推荐
- Synchronized solves problems caused by sharing
- egg. JS getting started navigation: installation, use and learning
- 电脑清理,删除的系统文件
- Let the bullets fly for a while
- [MySQL] log
- 【ROS】usb_cam相机标定
- China dihydrolaurenol market forecast and investment strategy report (2022 Edition)
- Mobile phones and computers on the same LAN access each other, IIS settings
- sys. argv
- JVM performance tuning and practical basic theory - Part 1
猜你喜欢
Deep learning: derivation of shallow neural networks and deep neural networks
Mobile phones and computers on the same LAN access each other, IIS settings
sublime text的编写程序时的Tab和空格缩进问题
JS native implementation shuttle box
指针进阶---指针数组,数组指针
pytorch训练好的模型在加载和保存过程中的问题
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
2022.02.13 - NC001. Reverse linked list
[MySQL] database stored procedure and storage function clearance tutorial (full version)
软件卸载时遇到trying to use is on a network resource that is unavailable
随机推荐
Remote storage access authorization
Fibonacci sequence
MySQL learning record 07 index (simple understanding)
JVM performance tuning and practical basic theory - Part 1
Function coritization
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
软件卸载时遇到trying to use is on a network resource that is unavailable
Colorlog结合logging打印有颜色的日志
Restful API design specification
2022.02.13 - 238. Maximum number of "balloons"
logback1.3. X configuration details and Practice
Research and investment forecast report of citronellol industry in China (2022 Edition)
Yyds dry goods inventory three JS source code interpretation eventdispatcher
Leetcode question brushing (5.28) hash table
[cloud native] teach you how to build ferry open source work order system
egg. JS getting started navigation: installation, use and learning
Day29-t77 & t1726-2022-02-13-don't answer by yourself
JS inheritance method
Screenshot in win10 system, win+prtsc save location
Upgrade tidb with tiup