Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # 整数
  5. print 1
  6.  
  7. print -1
  8.  
  9. print 0xf
  10.  
  11. print 010
  12.  
  13. #浮点数
  14.  
  15. #字符串
  16.  
  17. print "hello world"
  18.  
  19. print "I\'m Ok"
  20.  
  21. #想打印\\t,这样就需要加多个\来转移
  22.  
  23. print '\\\\t'
  24.  
  25. # Python还允许用r''表示''内部的字符串默认不转义
  26.  
  27. print r'\\t'
  28.  
  29. print "line1\nline2\nline3"
  30.  
  31. #如果字符串内部有很多换行,用\n写在一行里不好阅读,为了简化,Python允许用'''...'''的格式表示多行内容
  32.  
  33. print '''line1
  34. line2
  35. line3'''
  36.  
  37. #布尔值
  38.  
  39. b=3>2
  40.  
  41. print b
  42.  
  43. # or 或运算 and 与运算 not 非运算
  44.  
  45. b=True or False
  46.  
  47. print b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement