当前位置: 首页 > news >正文

创新的做pc端网站网站免费视频

创新的做pc端网站,网站免费视频,广州白云做网站的公司,国际新闻 军事流程控制 顺序结构、条件结构、循环结构#xff0c;顺序结构由自上而下的语句构成#xff0c;条件结构由if、match-case构成#xff0c;循环结构由for、while构成。 if语句 flag 1 if flag 1:print(A) elif flag 2:print(B) else:print(顺序结构由自上而下的语句构成条件结构由if、match-case构成循环结构由for、while构成。 if语句 flag 1 if flag 1:print(A) elif flag 2:print(B) else:print(C)match-case语句 结构模式匹配Python3.10引入 PEP 634 – Structural Pattern Matching: Specification PEP 635 – Structural Pattern Matching: Motivation and Rationale PEP 636 – Structural Pattern Matching: Tutorial # literal pattern def structural_pattern_matching(value):match value:case 1:print(A)case 2:print(B)case True:print(C)case False:print(D)case None:print(E)structural_pattern_matching(1) structural_pattern_matching(2) structural_pattern_matching(None) structural_pattern_matching(ABC)# capture pattern # guard是case的一部分为if语句def structural_pattern_matching(value):match value:case {sub: sub, **rest}:print(f{sub} {rest})case {route: route}:print(fROUTE: {route})structural_pattern_matching({route: /auth/login}) structural_pattern_matching({route: /auth/login, sub: {a: 1}})def go(obj):match obj:case go, [direction, num] if isinstance(num, int):print(fgo {direction} {num})case stop, *other:print(stop, *other)go([go, [east, 3]]) go([go, [east, 3]]) go([stop, 3, 2, 1])# as pattern def structural_pattern_matching(value):match value:case [go, (north | south | east | west) as direction]:print(fgo {direction})case _:print(B)structural_pattern_matching([go, west])# or pattern def structural_pattern_matching(value):match value:case 0 | 1 | 2:print(A)case True | False:print(B)structural_pattern_matching(1)# wildcard pattern # 通配符匹配任意值通配符匹配必须要在最后 # SyntaxError: wildcard makes remaining patterns unreachable def structural_pattern_matching(value):match value:case 1:print(A)case _:print(B)structural_pattern_matching(1) structural_pattern_matching(2)# Matching builtin classes # 可以按类型匹配 def structural_pattern_matching(obj):match obj:case str() as s:print(s)case [0, tuple() as t]:print(f{t})case list() as l:print(l)structural_pattern_matching(ooo) # ooo structural_pattern_matching([0, (1,)]) # (1,) structural_pattern_matching([(1,)]) # [(1,)] structural_pattern_matching([1, 2, 3]) # [1, 2, 3]# Matching positional attributes from dataclasses import dataclassclass Point1:__match_args__ (x, y)def __init__(self, x, y):self.x xself.y ydataclass class Point2:x: inty: intdef structural_pattern_matching(value):match value:case Point1(x, y):print(f{x}, {y})case Point2(x, y):print(f{x}, {y})structural_pattern_matching(Point1(1, 2)) structural_pattern_matching(Point2(3, 4))for语句 for i in range(10):print(i) else:print(break跳出不执行else)while语句 count 10 while count:count - 1print(count)# break# continue else:print(循环正常执行完毕没有被break打断)
http://www.yayakq.cn/news/5174/

相关文章:

  • 在菲做平台网站500强企业网站有哪些
  • 百度网站搜索关键字河北邢台出大事啦
  • 亚马逊没有网站怎么做seo亚马逊雨林动物大全
  • 农产品网站开发背景四会网站建设
  • 网站推广都有哪些公司注册资金可以取出来吗
  • 做网站的公司怎么做业务上海营销型网站开发
  • 网站做网站做任务手机网店开店网站
  • 广州网站优化地址网络优化关键词
  • 查询注册过的网站wordpress 判断登录页面跳转
  • 怎样建立网站ip地址wordpress排版问题
  • 哪里有免费的网站推广软件nodejs做网站的弊端
  • 网站规划小结steam交易链接怎么用
  • 电商网站 性能目标有哪些wordpress设置中文
  • dw软件做二级连接网站重庆seo多少钱
  • 有哪几种语言做的网站内部网站建设要求
  • wordpress 调用分类整站seo优化推广
  • 使用的电脑做网站的服务器长沙企业网站建立
  • tp5网站文档归档怎么做怎么做网站推广图片
  • 加强门户网站建设的方案深圳公司注册多少钱
  • 做策划的网站推广重庆seo排名公司
  • 厦门学网站设计安徽城乡与建设部网站
  • 宁波网站建设设计公司汕头seo快速排名
  • 淮安网站网站建设关于门户网站建设报告
  • 深圳市seo网站设计哪家好有哪些企业可以做招聘的网站有哪些
  • 深圳成交型网站建设东莞常平网络推广外包
  • 模版破解免费wordpress爱站网seo综合查询
  • 网站本身对网站打开速度有何影响申请了域名怎么做网站
  • 内江如何做百度的网站百度站长论坛
  • 设计类电子书网站对比网页设计网站
  • 怎么上传软件到网站合肥公司网站建设价格