suggest fix for #20
[rainbowstream.git] / rainbowstream / py3patch.py
CommitLineData
c3bab4ef 1"""
2 Python 3 supports
3"""
4import sys
5
6# StringIO module
7try:
77f1d210 8 from StringIO import StringIO, BytesIO
c3bab4ef 9except:
77f1d210 10 from io import StringIO, BytesIO
c3bab4ef 11
b2cde062
BR
12# HTMLParser module
13
14try:
15 from HTMLParser import HTMLParser
18df6e7f
O
16 def unescape(s):
17 p = HTMLParser()
18 return p.unescape(s)
b2cde062 19except:
18df6e7f 20 from html import unescape
b2cde062 21
c3bab4ef 22# raw_input and map functiion behaviour
422dd385 23if sys.version[0] == "3":
c3bab4ef 24 raw_input = input
422dd385 25 lmap = lambda f, a: list(map(f, a))
c3bab4ef 26else:
422dd385 27 lmap = lambda f, a: map(f, a)