Advertisement
rfmonk

ipython_log01.py

Jan 9th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.03 KB | None | 0 0
  1. # IPython log file
  2.  
  3. x = 6
  4. y = 5
  5. x, y = y, x
  6. print x
  7. print y
  8. get_ipython().magic(u'logstart')
  9. print "Hello" if True else "World"
  10. nfc = ["Seahawks", "Packers"]
  11. afc = ["Broncos", "Chargers"]
  12. print nfc + afc
  13. print str(1) + " world"
  14. `1` + "world"
  15. `1` + " world"
  16. print 1, "world"
  17. print nfc, 1
  18. print 5.0//2
  19. print 2**5
  20. print .3/.1
  21. print .3//.1
  22. x = 2
  23. if 3 > x > 1:
  24.     print x
  25.    
  26. if 1 < x > 0:
  27.     print x
  28.    
  29. nfc = ["Seahawks", "Packers"]
  30. afc = ["Broncos", "Chargers"]
  31. for teama, teamb in zip(nfc, afc):
  32.     print teama + " vs. " + teamb
  33.    
  34. get_ipython().magic(u'colors')
  35. get_ipython().magic(u'pinfo %colors')
  36. get_ipython().magic(u'color linux')
  37. get_ipython().magic(u'colors linux')
  38. hello world
  39. nfc = ["Seahawks", "Packers"]
  40. afc = ["Broncos", "Chargers"]
  41. for teama, teamb in zip(nfc, afc):
  42.     print teama +
  43.     " vs. " + teamb
  44.    
  45. for teama, teamb in zip(nfc, afc):
  46.              print teama + " vs. " + teamb
  47.    
  48. get_ipython().magic(u'colors lightbg')
  49. get_ipython().magic(u'colors linux')
  50. get_ipython().system(u'ls -F --color --colors')
  51. get_ipython().system(u'ls -F --color --color')
  52. compare.py
  53. compare
  54. get_ipython().magic(u'run compare')
  55. get_ipython().system(u'ls -F --color --color')
  56. ipython_log
  57. get_ipython().magic(u'run ipython_log')
  58. get_ipython().magic(u'run strings/string_capwords')
  59. get_ipython().magic(u'run strings/string_template')
  60. get_ipython().magic(u'run parallel/parallel')
  61. get_ipython().magic(u'run parallel/parallel.py')
  62. get_ipython().system(u'ls -F --color --color')
  63. get_ipython().magic(u'pwd --color')
  64. import code
  65. get_ipython().magic(u'pinfo2 code')
  66. get_ipython().system(u'ls -F --color ')
  67. get_ipython().magic(u'cd regex/')
  68. get_ipython().system(u'ls -F --color ')
  69. get_ipython().magic(u'pwd ')
  70. import re_email_verbose
  71. get_ipython().magic(u'pinfo2 re_email_verbose')
  72. get_ipython().system(u'ls -F --color --colors')
  73. get_ipython().system(u'ls -F --color --color')
  74. get_ipython().magic(u'cd ..')
  75. get_ipython().system(u'ls -F --color --color')
  76. get_ipython().magic(u'pwd ')
  77. for teama, teamb in zip(nfc, afc):
  78.              print teama + " vs. " + teamb
  79.    
  80. teams ["Packers", "Seahawks", "Broncos", "Cowboys"]
  81. teams = ["Packers", "Seahawks", "Broncos", "Cowboys"]
  82. for index, team in enumerate(teams):
  83.     print index, team
  84.    
  85. numbers = [1,2,3,4,5,6]
  86. even= []
  87. for number in numbers:
  88.     if number%2 == 0:
  89.         even.append(number)
  90.        
  91. numbers = [1,2,3,4,5,6]
  92. even = [number for number in numbers if number%2 == 0]
  93. teams = ["Packers", "Seahawks", "Broncos", "Cowboys"]
  94. print {key: value for value, key in enumerate(teams)}
  95. items = [0]*3
  96. print items
  97. [0,0,0]
  98. teams = ["Packers", "Seahawks", "Broncos", "Cowboys"]
  99. print ", ".join(teams)
  100. data = {'user': 1, 'name': 'Max', 'three': 4}
  101. try:
  102.     is_admin = data['admin']
  103. except KeyError:
  104.     is admin = False
  105.    
  106. data = {'user': 1, 'name': 'Max', 'three': 4}
  107. is admin = data.get('admin', False)
  108. x = [1,2,3,4,5,6]
  109. print x[:3]
  110. print x[1:5]
  111. for x in range(0,101):print"Fizz"[x%3*4:]+"Buzz"[x%5*4]or x
  112. for x in range(1,101):print"Fizz"[x%3*4:]+"Buzz"[x%5*4]or x
  113. from collections import Counter
  114. print Counter("hello")
  115. get_ipython().magic(u'logoff')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement