Skip to content

Instantly share code, notes, and snippets.

@marcwebbie
Last active August 29, 2015 14:12
Show Gist options
  • Save marcwebbie/c2f9438cb126ff65e952 to your computer and use it in GitHub Desktop.
Save marcwebbie/c2f9438cb126ff65e952 to your computer and use it in GitHub Desktop.
write-python3
from __future___ import print_function
try:
input = raw_input
str = unicode
range = xrange
except NameError:
pass
try:
from io import StringIO
from unittest.mock import Mock
except ImportError:
import StringIO
from mock i
import urllib.request, urllib.parse, urllib.error
value = list(range(1, 10))[-1]
if value != 9:
print("Value %s is not 9" % value)
else:
print("Value is 9")
try:
assert 1 == 2
except AssertionError as e:
print(e)
print(urllib.request.urlopen('https://docs.python.org/2/library/exceptions.html').read())
import urllib
value = range(1, 10)[-1]
if value <> 9:
print "Value %s is not 9" % value
else:
print "Value is 9"
try:
assert 1 == 2
except AssertionError, e:
print e
print urllib.urlopen('https://docs.python.org/2/library/exceptions.html').read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment