python
-
【iTestCat】分支if…else…(Python3自动化教程)
1)if 如果if语句判断是True,就把缩进的两行print语句执行了,否则,什么也不做。
1234#-*- coding:utf-8 -*-num = input('Please input your number: ')if num == '1':print('itestcat')2)if…else… 如果if判断是False,不要执行if的内容,去把else执行了:
123456#-*- coding:utf-8 -*-num =input('Please input your number: ')if num=='1':print('itestcat')else:print('itestcat.com')3)if…elif…else elif是else…
-
【iTestCat】Python2\Python3输入输出及区别(Python3自动化教程)
1.1输出 python2中输出可以使用空格或者小括号。 示例: print "hello itestcat"或者 print("hello itestcat") python3中输出只能小括号。 示例: print("hello itestcat") 1.2 输入 Python2中,…