![](https://img-blog.csdnimg.cn/6d2dfee8a39641909c2b4744fd5abf31.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Python For Everybody
文章平均质量分 65
https://www.coursera.org/specializations/python
https://www.py4e.com/lessons
感谢Dr. Chuck!
wnuow
商科转码选手
展开
-
【Python for Everybody】1 Introduction
Hardware Overview作为programmer,我们是写一些程序在main memory里,作为指令告诉CPU what next,CPU帮我们执行。Reserved Wordswords that reserved for Python 去识别Statements or Lines一行代码叫做 a lineInteractive vs ScriptInteractive 输入了就立刻执行Script 通过text editor,写了一系列代码在文件里,然后再执行Progra原创 2021-12-27 13:31:02 · 348 阅读 · 0 评论 -
【Python for Everybody】2 Variables, expressions and statements
Constants固定值,如数字、字母、字符串Reserved Words告诉python执行条件,不可用做variable names/identifierVariablesmemory里的一块可被命名的空间,可存储信息,稍后可通过它的“name”去retrieve命名规则:只能有字母或下划线开头,并只能有字母、数字、下划线(underscore)组成学会命mnemonic(助记的) variable name:Assignment Statement用=给变量赋值Numeric E原创 2021-12-27 15:14:06 · 201 阅读 · 0 评论 -
【Python for Everybody】3 Conditional Execution
Comparison OperatorsOne-way decisionif …:print()print()Indentationtab等于4个spaces,但是space和tab不能混用Nested decisionsif …:if…:print()print()print()Two-Way Decisionsif …:print()else:print()print()Muti-Way Decisionsif …:print()elif …:print原创 2021-12-27 16:44:17 · 186 阅读 · 0 评论 -
【Python for Everybody】4 Functions
Stored (and Reused) Stepsdef ...: ...比如def thing(): #构造一个thing函数 print('hello') #定义thing函数为输出hellothing() #执行后的output为hello原创 2021-12-27 22:58:15 · 143 阅读 · 0 评论 -
【Python for Everybody】5 Loops and Iterations
Repeated Stepsiteration variable我们构造出来用于控制该循环的变量,它告诉我们这个循环会循环几次While LoopWhile ...: #满足条件(即当...时候)开始循环 ....#停止循环infinite loop没有控制循环,导致其无限循环zero trip没有进入循环以至于跳过Loop Control StatementBreak#输出5n=0while True: #一直循环 if n>4: print(n) brea原创 2021-12-28 19:15:32 · 415 阅读 · 0 评论 -
【Python for Everybody】6 Strings
Index我们可以用square bracket[ ]里Index去提取string中的任意字符index value是从零开始的整数如果你试图index超过字符串长度的值,会报错Lenthlen()计算字符串的长度Looping Through Stringswhile用while statement、iteration variable和len function构建循环,去查看string里的每一个字母fruit = 'banana'index = 0while index原创 2021-12-28 22:58:09 · 328 阅读 · 0 评论 -
【Python for Everybody】7 Files
text filea sequence of linesFile Processing:handle = open(filename, mode)filename is a stringmode is optional, it should be ‘r’ if wanna read the file and ‘w’ if wanna wirte to the filereturn a “file handle”hande 是指对file进行open、read、write、closewhen fi原创 2022-07-14 15:12:09 · 167 阅读 · 0 评论 -
【Python for Everybody】8 List
AlgorithmsA set of rules or steps used to solve a problemData StructureA particular way of organizing data in a computer和string类似,index都从0开始,可以用[]来索引Concatenating lists using +list.append() 在list 末尾增加一个元素list.insert(n,‘4’) 在指定位置添加元素,如果指定的下标不存在,那么就原创 2022-07-14 16:53:01 · 279 阅读 · 0 评论 -
【Python for Everybody】9 Dictionaries
dict.get(key,value)如果原字典里没有这个key,则将该key加入字典并附值value。用dict()或{}创建空字典。原创 2022-07-14 19:30:57 · 73 阅读 · 0 评论 -
【Python for Everybody】10 Turple
comparisonoperator适用于turple,从左至右依次进行比较,第一个元素如果能比出结果就不会再继续读取元素比较。对于temporaryvariable,一般我们使用turple而非list。用for循环将key-valuepair变成value-keypair。因为turple不可修改,它比list效率更高、占用内存更小。可以将turple理解成limitedlist。turple的一个赋值语句可以给两个变量赋值。count()某个元素在元组中出现的次数。...原创 2022-07-14 22:22:07 · 259 阅读 · 0 评论 -
【Python for Everybody】11 Regular Expressions
RegularExpressions,或叫做regex/regexp,是一种简洁灵活的匹配文本字符串的方法,是匹配与分析string的wildcard(万能牌)。如re.search(’^From',line),表示在line里寻找以From为句首的字符串。re.findall()提取string中匹配正则表达式中的部分,类似于find()和slicing[]的结合。“^X.*”表示以X开头,以结尾,中间随便是什么的文本,其中X和可以视为lockcharacter。......原创 2022-07-15 17:03:46 · 184 阅读 · 0 评论 -
【Python for Everybody】12 Network Programming
采用urllib可以将网页内容像file一样处理。调用socket包创建socket。有些网站不能爬,得看条款。用于获取网页中的链接。原创 2022-07-15 22:09:26 · 226 阅读 · 0 评论 -
【Python for Everybody】13 Using Web Services
XMl更多用于文件。原创 2022-07-16 17:47:23 · 251 阅读 · 0 评论 -
【Python for Everybody】14 Object-Oriented Programming
httpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttps。原创 2022-07-17 15:03:29 · 413 阅读 · 0 评论 -
【Python for Everybody】15 Databases
数据库的建设很复杂,但复杂的构建正意味着理清了数据之间的关系逻辑,这大大提高了数据的处理速度httpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttpshttps。.........原创 2022-07-18 09:50:59 · 166 阅读 · 0 评论 -
【Python for Everybody】16 Data Visualization
找出哪个网页拥有most best links原创 2022-07-18 12:33:34 · 317 阅读 · 0 评论 -
【Python for Everybody】所有assignment课后作业代码
Findthelinkatposition18(thefirstnameis1).Followthatlink.Repeatthisprocess7times.Theansweristhelastnamethatyouretrieve.(重复7次,分别找出网页中位置第18的链接,并得到最后一次的链接上的人名)这题只需要按步骤复制粘贴就行了。按照提示操作就行,代码基本没改。...原创 2022-07-22 23:05:51 · 3375 阅读 · 1 评论 -
【Python for Everybody】quiz, assignment, exercise知识点
COUNT(*)表示ItcountstherowsinthetableUsers。只能由字母或下划线开头,并只能由字母、数字、下划线(underscore)组成。原创 2022-07-22 23:14:10 · 517 阅读 · 0 评论