Python学习笔记.md】的更多相关文章

Python学习笔记 1.变量类型 x=5 int x="ss" string x='a' string x=True bool #查看变量类型 type(x) 2.字符串常用操作 a.首字母大写 x="add user" print(x.title() # Add User b.全部大写/小写 p…
文件与文件路径 路径合成 os.path.join() 在Windows上,路径中以倒斜杠作为文件夹之间的分隔符,Linux或OS X中则是正斜杠.如果想要程序正确运行于所有操作系统上,就必须要处理这种情况.os.path.join()方法可以正确的根据不同的操作系统来合成路径,它的用法如下: >>> import os >>> os.path.join("Program", "QQ", "Pet") 'Pro…
python学习笔记整理 数据结构--字典 无序的 {键:值} 对集合 用于查询的方法 len(d) Return the number of items in the dictionary d. 返回元素个数 d[key] Return the item of d with key key. Raises a KeyError if key is not in the map. If a subclass of dict defines a method _missing_() and key…
前言 前面我简单介绍了Python的Hello World.看到有人问我搞搞Python的Web,一时兴起,就来试试看. 第一篇 VS2013中Python学习笔记[环境搭建] 简单介绍Python环境的搭建过程,以及Hello World的实现. 第二篇 VS2013中Python学习笔记[基础入门] 我简单学习使用了Python的几个基础的知识点. 第一个Web页面 第一步:首先打开VS2013开发工具 ,新建项目,选择Django Project模版. 修改项目名称,可以查看到项目的文件结…
个人总结: import module,module就是文件名,导入那个python文件 import package,package就是一个文件夹,导入的文件夹下有一个__init__.py的文件, __init__.py可以有两种形式, 一种是直接import多个模块,例如 import fibo import abc 另外一种是 __all__ = ["A","B"] python学习笔记之module && package python的mo…
python学习笔记(六) 文件夹遍历 1.递归遍历 import os allfile = [] def dirList(path): filelist = os.listdir(path) for filename in filelist: filepath=os.path.join(path,filename) if(os.path.isdir(filepath)): dirList(filepath) allfile.append(filepath) return allfile pri…
接上一节  python学习笔记--Django入门四 管理站点 设置字段可选 编辑Book模块在email字段上加上blank=True,指定email字段为可选,代码如下: class Author(models.Model): first_name = models.CharField(max_length=) last_name = models.CharField(max_length=) email = models.EmailField(blank=True ) 所有字段都默认bl…
经过这几天的折腾,经历了Django的各种报错,翻译的内容虽然不错,但是与实际的版本有差别,会出现各种奇葩的错误.现在终于找到了解决方法:查看英文原版内容:http://djangobook.com/ 加入你使用的是CentOS系统或者Mac,默认版本是2.X,请及时更新版本到3.X 书中是这么说的: You can see that, and Python to be installed. If your system . 对于没有经验的人来说,使用python2.7 ,这是一个陷阱! Dan…
python学习笔记(一)元组,序列,字典…
Pythoner | 你像从前一样的Python学习笔记 Pythoner…