File tree 2 files changed +34
-0
lines changed
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 3
3
## sublime插件
4
4
* [ SublimeREPL] ( https://github.com/wuub/SublimeREPL ) 允许你在编辑界面直接运行 Python 解释器;以及执行python文件。
5
5
6
+ ## 一些概念
7
+ ### 缩进
8
+ 不要混合使用制表符和空格来缩进,因为这在跨越不同的平台的时候,无法正常工作。我 强烈建议 你在每个缩进层次使用 单个制表符 或 两个或四个空格 。
9
+ 选择这三种缩进风格之一。更加重要的是,选择一种风格,然后一贯地使用它,即 只 使用这一种风格。
10
+
6
11
## 代码规范
7
12
* http://ssv.sebug.net/Python_Coding_Rule
8
13
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+ #coding:utf-8
3
+ # 注意! 在python中单引号和双引号字符串是完全相同的
4
+ print 'aaa'
5
+ print "bbb"
6
+ # 在一个字符串中,行末的单独一个反斜杠表示字符串在下一行继续,而不是开始一个新的行,即输出时,仍然输出时并不换行
7
+ print "This is the first sentence.\
8
+ This is the second sentence."
9
+
10
+
11
+ print '''This is a multi-line string. This is the first line.
12
+ This is the second line.
13
+ "What's your name?," I asked.
14
+ He said "Bond, James Bond."
15
+ '''
16
+
17
+
18
+ # Unicode是书写国际文本的标准方法。
19
+ # 如果你想要用你的母语如北印度语或阿拉伯语写文本,那么你需要有一个支持Unicode的编辑器。
20
+ # 类似地,Python允许你处理Unicode文本——你只需要在字符串前加上前缀u或U。例如,u"This is a Unicode string."。
21
+ # 记住,在你处理文本文件的时候使用Unicode字符串,特别是当你知道这个文件含有用非英语的语言写的文本。
22
+ print u'中文的东东'
23
+
24
+ # \ 与其他语言一样的转义
25
+ print 'aaa\n bbb\b ccc'
26
+
27
+ # 用空格来连接字符串
28
+ s = 'abc' 'def' 'hij' ;
29
+ print s ;
You can’t perform that action at this time.
0 commit comments