摘要: 列子:GBK 转换为UTF-8: 1.GBK首先解码[decode]为Unicode编码 2.然后Unicode编码[encode]为UTF-8编码 阅读全文
posted @ 2017-09-09 15:11 家阳光 阅读(174) 评论(0) 推荐(0)
摘要: 1 ''' 2 file = open("test",'r',encoding="utf-8") 3 4 'r' open for reading (default) 5 'w' open for writing, truncating the file first 6 'x' create a new fil... 阅读全文
posted @ 2017-09-09 14:30 家阳光 阅读(174) 评论(0) 推荐(0)
摘要: list_1 = [1,2,3,4,5]list_2 = [1,3,5,7,9]#列表转成set集合set_1 = set(list_1)set_2 = set(list_2)#交集print(set_1.intersection(set_2))print(set_1 & set_2)#判断没有交集 阅读全文
posted @ 2017-08-19 22:11 家阳光 阅读(175) 评论(0) 推荐(0)
摘要: '''Dict 字典存储的是key-value键值对形式的值特点: 1.无序,因为无下标 2.key值是唯一的,自动去重'''person = { "name":"xiaoming", "age" : 20}#根据key查询值print(person["name"])print(person["ag 阅读全文
posted @ 2017-08-19 22:02 家阳光 阅读(182) 评论(0) 推荐(0)
摘要: '''列表 有序 可重复'''nums = ["1","2","3",4]print("nums 列表 :"+str(nums))# 遍历列表 print(" for 遍历 ")for n in nums: print(n) print(" 间隔打印 ")print(nums[1:2:2])#beg 阅读全文
posted @ 2017-08-15 22:45 家阳光 阅读(134) 评论(0) 推荐(0)
摘要: 1.编码 python3 默认是utf-8编码,可以显示指定编码 或者 2.标识符 第一个字符必须是字母表中字母或下划线'_'。 标识符的其他的部分有字母、数字和下划线组成。 标识符对大小写敏感。 3.保留字 保留字即关键字,我们不能把它们用作任何标识符名称。Python 的标准库提供了一个 key 阅读全文
posted @ 2017-08-13 21:14 家阳光 阅读(124) 评论(0) 推荐(0)
摘要: 今天开始学习python,照常第一个Hello World 奉上 Ctrl+R 输入 cmd 打开命行. 阅读全文
posted @ 2017-08-13 21:13 家阳光 阅读(154) 评论(0) 推荐(0)