当前位置:网站首页>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 ,
边栏推荐
猜你喜欢
C language double pointer -- classic question type
[brush questions] top101 must be brushed in the interview of niuke.com
Unified ordering background interface product description Chinese garbled
Bottom up - physical layer
Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
C語言雙指針——經典題型
C语言深度解剖——C语言关键字
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
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 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
Tidb backup and recovery introduction
Pointer advanced --- pointer array, array pointer
torch建立的网络模型使用torchviz显示
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
从表中名称映射关系修改视频名称
leetcode刷题 (5.29) 哈希表
C語言雙指針——經典題型
sys. argv
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes
ROS编译 调用第三方动态库(xxx.so)
Upgrade tidb with tiup
Restore backup data on S3 compatible storage with tidb lightning
Colorlog结合logging打印有颜色的日志
China's high purity aluminum target market status and investment forecast report (2022 Edition)
China high purity silver nitrate Market Research and investment strategy report (2022 Edition)
Use br to back up tidb cluster data to S3 compatible storage
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
Wincc7.5 download and installation tutorial (win10 system)
C语言双指针——经典题型