摘要:1.遍历字符串中每个字符的for循环 name="Ted"for character in name: print(character)2. for遍历列表元素 shows=["GOT", "You" "Know" ]for show in shows: print(show)3.for遍历元组中的
阅读全文
摘要:1.列表,[ ],删除最后一个元素pop,添加到末尾Append,有序的 代码: colors=["purple", "orange", "green"]guess=input("Guess a color:")if guess in colors: print("You guessed corre
阅读全文
摘要:1.算法:解决问题的一系列步骤。 2.【FizzBuzz问题】编写一个程序,打印从1到100之间的数字,碰到3 的倍数,打印Fizz,碰到5的倍数,打印Buzz,如果是3和5共同的倍数,打印FizzBuzz。 def fizz_buzz(): for i in range(1,101): if i%
阅读全文
摘要:1.栈-先进后出LIFO 出栈 poping,入栈pushing 栈的5个方法:is_empty,push(向栈的顶部添加一个元素),pop(从顶部移除一个元素),peek(返回顶部的元素,但不会移除),size(返回一个表示栈中元素数量的整型数) 2.代码举例如下: class Stack: de
阅读全文
摘要:1.安装beauitfulsoup4 cmd-> pip install beautifulsoup4python提供了一个支持处理网络链接的内置模块urllib,beatuifulsoup是用来解析html 验证安装是否成功 2. pycharm配置 3.代码如下 import urllib.re
阅读全文
摘要:笔者使用的是Window系统,我使用在线工具 https://c.runoob.com/compile/18 https://www.tutorialspoint.com/execute_bash_online.php 1. 2.查看所有最近命令列表 :$ history 3.相对路径和绝对路径:目
阅读全文
摘要:# L14 深入面向对象编程#14.1类有2种类型的变量:类变量与实例变量class Rectangle(): def __init__(self,w,l): self.width=w self.len=l def print_size(self): print("""{}by""".format(
阅读全文
摘要:#封装,继承,多态,抽象#封装#1.封装1:在面向对象编程中,对象将变量和方法集中在一个地方,即对象本身class Rectangle(): def __init__(self,w,l): self.width=w self.len=l def area(self): return self.wid
阅读全文
摘要:Git 1.版本控制(配置管理) 集中式SVN/CVS 分布式版本管理系统GIT 2.查看Git是否已经安装 git –-version 下载git for Win 新建空白文件右击-》git bash 3.git init- Git add-Git commit-Git push 首先git in
阅读全文