摘要: Pypi网站 https://pypi.python.org/pypi 账号keiweila 密码Gujinrong1234 1列表基本 Cast = [‘aaa’,’aa’]; len(cast) Cast.append(‘bb’) Cast.extend([‘cc’,11]) cast.inse 阅读全文
posted @ 2018-01-06 11:10 克维拉 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 7美国出生率 def calc_counts(data, column): sums_dict = {} for row in data: col_value = row[column] births = row[4] if col_value in sums_dict: sums_dict[col 阅读全文
posted @ 2018-01-06 11:09 克维拉 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 6工具jupyter 安装打开 python3 -m pip install --upgrade pip python3 -m pip install jupyter jupyter notebook 2 a=open('/Users/gu/test.php') ar =a.read() print 阅读全文
posted @ 2018-01-06 11:08 克维拉 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 5错误 1有时Python解释器将返回一个IndentationError IndentationError当我们的代码中的缩进不一致时 2 TypeError类型出错 a+"42" 3ValueError类型出错 float("adada") 3 IndexError是我们尝试访问不在列表索引中的 阅读全文
posted @ 2018-01-06 11:08 克维拉 阅读(476) 评论(0) 推荐(0) 编辑
摘要: 4Requestdata我们使用花括号({)创建一个新的字典。我们可以像这样做一个空字典: scores = {} scores["Tom"] = 70 students = { "Tom": 60, "Jim": 70 } 在更复杂的功能中练习使用字典 阅读全文
posted @ 2018-01-06 11:07 克维拉 阅读(1003) 评论(0) 推荐(0) 编辑
摘要: 3Requestdata3判断 检查某个元素是否存在于列表或者字典 animals = ["cat", "dog", "rabbit"] if "cat" in animals: print("Cat found") cat_found = "cat" in animals 1requestData 阅读全文
posted @ 2018-01-06 11:06 克维拉 阅读(380) 评论(0) 推荐(0) 编辑
摘要: 2requestData处理文件 1 Open(路径,模式create/read/write/append mode) 该open()函数返回一个File对象,并允许我们调用特定于File类的方法 f= open(“text.txt”,’r’) g=f.read()文件对象有一个read()返回文件 阅读全文
posted @ 2018-01-06 11:06 克维拉 阅读(223) 评论(0) 推荐(0) 编辑