We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3004eb8 + 9c0de6e commit 431f38aCopy full SHA for 431f38a
1 file changed
microdata.py
@@ -226,9 +226,13 @@ def _make_item(e):
226
227
228
if __name__ == "__main__":
229
- import urllib
+ try:
230
+ from urllib.request import urlopen
231
+ except ImportError:
232
+ from urllib import urlopen
233
+
234
if len(sys.argv) < 2:
- print "Usage: %s URL [...]" % sys.argv[0]
235
+ print("Usage: %s URL [...]" % sys.argv[0])
236
sys.exit(1)
237
238
for url in sys.argv[1:]:
@@ -237,7 +241,7 @@ def _make_item(e):
241
microdata = {}
242
microdata['items'] = items = []
239
243
240
- for item in get_items(urllib.urlopen(url)):
244
+ for item in get_items(urlopen(url)):
245
items.append(item.json_dict())
246
- print json.dumps(microdata, indent=2)
247
+ print(json.dumps(microdata, indent=2))
0 commit comments