count = 1 flag = True while flag: print(count) count += 1 ''' # +=: count = count + 1 ''' if count == 101: flag = False count = 1 while count < 100: print(count) count -= 100
''' python 入门 ''' def index(request): if request.method == "POST": username = request.POST.get("username") password = request.POST.get("password") if username == "zhuyu" and password == "123456": return redirect("http://www.baidu.com/") else: return HttpResponse("用户密码错误") return render(request,"login.html") 这是python的一个注释点 print(1+2+3+4+5) print("hello worle") age = 5 print(age, type(age)) print('1<2') print(1>2,type(1>2)) name = input("请输入您的姓名:") age = input("请输入您的年龄:") s1 = '我的名字是' s2 = '我的年龄是' print(s1+name,s2+age) msg = '''ma name is alex''' print(msg,type(msg)) name= input("请输入姓名") age= int(input("请输入年龄")) job= input("请输入职业") hobby= input("请输入爱好") msg = ''' # ------------ info of %s ----------- # Name : %s # Age : %d # job : %s # Hobbie: %s # ------------- end ----------------- '''%(name,name,age,job,hobby) print(msg) ''' ''' str = input("请输入数字:") if str == "1": print("我们一起去学习!") elif str == "2": print("一起吃小龙虾") else: print("在家里休息") # print(777) flag = True while flag: print('a') print('b') print('c') flag = False print(888) print(flag) count = 1 flag = True while flag: print(count) count += 1 ''' # +=: count = count + 1 ''' if count == 101: flag = False count = 1 while count < 100: print(count) count -= 100