Python学习笔记之20140406
来源:互联网 发布:日本捕鲸 知乎 编辑:程序博客网 时间:2024/06/14 10:47
# Time : 2014-4-6 23:39 Python学习笔记
1.Python输出中文
#!/usr/bin/python
#coding:utf-8
2.Python %s %r的区别
The %s specifier converts the object using str(), and %r converts it using repr().
For some objects such as integers, they yield the same result, but repr() is special in that (for types where this is possible) it conventionally returns a result that is valid Python syntax, which could be used to unambiguously recreate the object it represents.
Here's an example, using a date:
>>> d = datetime.date.today()
>>> str(d)
'2011-05-14'
>>> repr(d)
'datetime.date(2011, 5, 14)'
Types for which repr() doesn't produce Python syntax include those that point to external resources such as a file, which you can't guarantee to recreate in a different context.
3.print "." * 10 以及 + 的应用
4. formatter = "%r %r %r %r"
5. \n \t 以及 """ 以及转义字符(diffcult-to-type)\的使用
6. 输入函数 raw_input()
0 0
- Python学习笔记之20140406
- Python学习笔记之零
- Python学习笔记之递归
- Python学习笔记之全局变量
- python学习笔记之yield
- python 学习笔记之字典
- python 学习笔记之list
- python 学习笔记之string
- python 学习笔记之minidom
- python学习笔记之三
- Python学习笔记之全局变量
- Python学习笔记之列表
- Python学习笔记之字典
- OpenCV之Python学习笔记
- python学习笔记之二
- python 之序列学习笔记
- PYTHON学习笔记之URLLIB2
- OpenCV之Python学习笔记
- 线程的中断阻塞与控制
- 数学之美:自然语言处理-从规则到统计
- Java线程组与线程未捕获的异常
- MySQL 分类取前N条 sql 写法
- 面试-cookie和session的区别
- Python学习笔记之20140406
- 基于样例的图像修复算法的几种加速手段
- Java线程ThreadLocal
- Weblogic学习笔记-Weblogic 域(Domain)(三)
- 面试-HTTP协议详解
- Java I/O流的认识
- Linux认证:Linux内核参数修改方法
- 【Android】事件传递:向下拦截,向上处理
- Java Reader/Write的概述