6.1日周二个人作业二每日总结
6.1日周二个人作业二每日总结
今日收获:学习爬虫知识,运行第一个python项目
Python3 条件控制
Python 条件语句是通过一条或多条语句的执行结果(True 或者 False)来决定执行的代码块。
if 语句
Python中if语句的一般形式如下所示:
if condition_1: statement_block_1 elif condition_2: statement_block_2 else: statement_block_3
- 如果 "condition_1" 为 True 将执行 "statement_block_1" 块语句
- 如果 "condition_1" 为False,将判断 "condition_2"
- 如果"condition_2" 为 True 将执行 "statement_block_2" 块语句
- 如果 "condition_2" 为False,将执行"statement_block_3"块语句
Python 中用 elif 代替了 else if,所以if语句的关键字为:if – elif – else。
遇到问题:for循环的格式
浙公网安备 33010602011771号