`

Python Learning

 
阅读更多


1. # -*- coding: utf-8 -*-  推荐使用,解决不同编辑环境中文编码问题

2. 使用“d:\\new.txt“而非“d:\new.txt“,后者会出现转义字符问题

3. Dictionary 类似于Java中的map,key 是大小写敏感

4. List 使用比较频繁

5.  空串 ("") ,空 list ([]) ,空 tuple (()) , 空 dictionary ({}) 为 false

6. Tuple 是不可变的 list。一旦创建,就不能以任何方式改变它。Tuple 比 list 操作速度快,

7. 单引号与双引号在python中等效使用

8.“what’sthis”表示方式

  • 1:’what \’s this’. 这里用到了转义符’\’

  • 2:”what’s this”

9. " I am first.\

     He is second."  等价于 I am first. He is second.

10. r/R 指定字符串  比如r"Happy\n"这里的\n不是换行而是普通字符

11. u/U指定使用unicode编码. 比如:u“Happy”

12. “what’s””your name” 等价于  ”what’syour name”

13. ** 幂运算   // (mod)   and or not

14. print line,  ,的作用是抑制print产生的换行

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics