Python学习笔记之20140406
2014-04-07 00:24
375 查看
# 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()
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()
相关文章推荐
- 1.python学习笔记:python连接mysql数据库
- Python学习笔记(十)匿名函数
- Python学习笔记(七)函数的使用
- Python学习笔记四:过程控制
- Python爬虫学习笔记Day3
- python-PIL学习笔记
- Python3学习笔记7-文件的读写
- Python系列学习笔记(一)——入门学习
- Python学习笔记2
- 学习笔记-小甲鱼Python3学习第三十一讲:永久存储:腌制一缸美味的泡菜
- Python学习笔记(一)
- Python学习笔记:单引号,双引号,三引号
- python 学习笔记 (五)
- 【零基础入门学习Python笔记012】一个打了激素的数组3
- python 学习笔记二之sklearn 库
- python 制作图表 matplotlib - 千月的python linux 系统管理指南学习笔记(18)
- <<Python基础教程>>学习笔记 | 第14章 | 网络编程
- Python学习笔记五:数字和字符串
- Python学习笔记(1)
- Python学习笔记[01]-Python开发环境准备