Python Data Representations
XiaohanClover
Everyday struggle with code!!!
展开
-
Python Data Representation学习笔记【Week1】——Python Strings
一、String的表示方法1.声明一个String可以用" "或者' ',两者没有差别,为了方便使用,可以在字符串内容中含有 ' 时用" ",同理也可以在含有 " 时用' ',避免使用转义字符。# Strings are enclosed in quotesname = 'Scott Rixner'university = "Rice"print(name)print(un...原创 2019-03-25 16:22:56 · 160 阅读 · 3 评论 -
Python Data Representation学习笔记【Week2】——Python Lists
一、创建一个List1.直接用[]的形式创建一个list,list可以为空,也可以为数值、字符串等。P.S.List没有数据类型限制,将不同的数据类型混合组成一个list仍然可以正常执行程序,但不建议这样做。在List中存放相同数据类型的数据会更容易处理,且不容易出错。print("List Literals")print("=============")# List lite...原创 2019-03-26 14:44:51 · 444 阅读 · 2 评论 -
Python Data Representation学习笔记【Week4】——Python Files
一、Files的四种基本操作:open, read, write, close1.Python打开文件的open()函数-两个参数。open(文件名:String,打开方式:String) ,例:# Open takes a filename and a modeopenfile = open("the_idiot.txt", "rt")print(type(openfile)...原创 2019-03-29 23:28:21 · 226 阅读 · 0 评论 -
Python Data Representation 【Week 4 Exercise】:Practice Project: Updating the CodeSkulptor Docs
Practice Project: Updating the CodeSkulptor Docsdebug了好久的我实在是太菜了.."""Week 4 practice project template for Python Data RepresentationUpdate syntax for print in CodeSkulptor Docsfrom "print ..."...原创 2019-03-30 18:30:34 · 246 阅读 · 0 评论 -
Python Data Representation Final Project: File Differences
Project: File Differences啊~终于调试到满分了~测试了整整7次~"""Project for Week 4 of "Python Data Representations".Find differences in file contents.Be sure to read the project description page for further ...原创 2019-03-31 00:30:14 · 443 阅读 · 0 评论 -
Python Data Representation学习笔记【Week3】——Python List Manipulation
一、改变List的内容1.改变list中的某个item的值。用index指定需要改的元素,直接赋新值。lst = list(range(5))print(lst)lst[1] = -7lst[3] = 17print(lst)输出结果为:2.给list增加新的item-用append()函数在list末尾增加一个itemlst.append(42)pri...原创 2019-03-28 18:08:02 · 237 阅读 · 3 评论