Attachment 'coffeeghost-q-in-py.py'
Download 1 # -*- coding: utf-8 -*-
2 # Quick Pytohn Script Explanation for Progeammers
3 # 给程序员的超快速Py脚本解说
4 import os
5
6 def main():
7 print 'Hello World!'
8
9 print "这是Alice\'的问候."
10 print '这是Bob\'的问候.'
11
12 foo(5, 10)
13
14 print '=' * 10
15 print '这将直接执行'+os.getcwd()
16
17 counter = 0
18 counter += 1
19
20 food = ['苹果', '杏子', '李子', '梨']
21 for i in food:
22 print '俺就爱整只:'+i
23
24 print '数到10'
25 for i in range(10):
26 print i
27
28 def foo(param1, secondParam):
29 res = param1+secondParam
30 print '%s 加 %s 等于 %s'%(param1, secondParam, res)
31 if res < 50:
32 print '这个'
33 elif (res>=50) and ((param1==42) or (secondParam==24)):
34 print '那个'
35 else:
36 print '嗯...'
37 return res # 这是单行注释
38 '''这是多
39 行注释......'''
40
41 if __name__=='__main__':
42 main()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.