摘要: for循环:1,基础训练 方法一 例1 for i in (1,2,3,4,5,6,7,8,9,0): print('lpc') print(i) 元素列表: (1,2,3,4,5,6,7,8,9,0): for循环会对应匹配列表里每一个值,直到讲所有值循环完成结束 方法二 例1 for i in 阅读全文
posted @ 2018-03-26 17:01 Leonardo-li 阅读(1077) 评论(0) 推荐(0)
摘要: 1 import random 2 import pygame 3 import sys 4 from pygame.locals import * 5 6 Snakespeed = 17 7 Window_Width = 800 8 Window_Height = 500 9 Cell_Size 阅读全文
posted @ 2018-03-23 16:00 Leonardo-li 阅读(806) 评论(0) 推荐(0)
摘要: while True: print('who are you?') name=input() if name !='student': continue print('hello ' + name) print('请形容一下他,如,niu') r=input() if r=='niu': break 阅读全文
posted @ 2018-03-23 15:54 Leonardo-li 阅读(211) 评论(0) 推荐(0)
摘要: while True: print('请输入“thinks”') spam=input() if spam=='thinks': break print('yes it is!') break: 跳出真个循环语句并结束循环 阅读全文
posted @ 2018-03-23 15:51 Leonardo-li 阅读(248) 评论(0) 推荐(0)
摘要: 1.编写一个判断(if)两次输入密码是否一致的python代码文件 print('请输入密码——') passwd=input() print('再次输入密码——') passwd1=input() if passwd !=passwd1: print('密码不正确,请重新输入——') passwd 阅读全文
posted @ 2018-03-23 15:46 Leonardo-li 阅读(584) 评论(0) 推荐(0)
摘要: 一 name='' while name !='xiaoming': print('谁是小帅哥,暗号:xiaoming') name=input() print('yes,it is!') 二 name=0 while name<5: print('你好,lpc') name+=1 阅读全文
posted @ 2018-03-23 15:33 Leonardo-li 阅读(257) 评论(0) 推荐(0)
摘要: vim os.py import os //系统模块print('请输入你的目录:')dirname=input()print('zhixingmulu: ')path=input()os.system('mkdir '+ path + dirname) 实现的效果: 通过调用python系统模块, 阅读全文
posted @ 2018-03-23 15:25 Leonardo-li 阅读(239) 评论(0) 推荐(0)
摘要: 1.使用python的语言的公司 YouTube 世界最大的视频网站,用python开发的 youku,中国最大的视频网站 Dropbox美国最打云存储网站,python的创始人就在这家公司 Ansible 被Redhat收购了,2亿美元 腾讯蓝鲸,游戏平台,开源的,如英雄联盟 2.语言全球排名: 阅读全文
posted @ 2018-03-23 15:19 Leonardo-li 阅读(278) 评论(0) 推荐(0)
摘要: print('请输入自己名字:') who=input() print('hello ' + who) print('请问您的年龄:') age=input() print('来年你的年龄:' + str(int(age)+1) + '岁') 实现效果: 交互式询问你的姓名年龄,并猜出你来年的年龄。 阅读全文
posted @ 2018-03-23 15:15 Leonardo-li 阅读(364) 评论(0) 推荐(0)
摘要: mkdir /root/test/ vim /root/test/test1.yaml 添加: hosts: 39.107.103.225 // 第一个任务 gather_facts: False //不读取对方主机的信息 tags: //主机标签一 - play1 tasks: - name: c 阅读全文
posted @ 2018-03-17 14:34 Leonardo-li 阅读(1389) 评论(0) 推荐(0)