Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pickle, urllib
- handle = urllib.urlopen("http://www.pythonchallenge.com/pc/def/banner.p")
- data = pickle.load(handle)
- handle.close()
- for elt in data:
- print "".join([e[1] * e[0] for e in elt])
- print "".join([e[1] * e[0] for e in elt])
- x = []
- for e in elt:
- x.append(e[1] * e[0])
- print "".join(x)
- >>> data[0]
- [(' ', 95)]
- >>> ':'.join(['ab', 'cd'])
- >>> 'ab:cd'
- for elt in data:
- for e in elt:
- print "e[0] == %s, e[1] == %d, which gives us: '%s'" % (e[0], e[1], ''.join(e[1] * e[0]))
- print "".join([e[1] * e[0] for e in elt])
- print "".join([e[1] * e[0] for e in elt if len(e) == 2])
Add Comment
Please, Sign In to add comment