![]() For this research, the codes B 2.5- Eirene and EMC3- Eirene were extensively used for design studies of the planned Material Plasma Exposure eXperiment (MPEX). Linear plasma generators are cost effective facilities to simulate divertor plasma conditions of present and future fusion reactors. Print "info:",bz2.decompress(urllib.Transport simulations of linear plasma generators with the B 2.5- Eirene and EMC3- Eirene codes ''.join(re.findall(), text) is always better than (re.findall(), text), because it avoids the possible ‘index out of range’ problem.Ĭookies = ().getheaders('Set-Cookie')īyte = cookies.split(' ').split('=') (re.findall(), text) returns a list of one(or zero) element. New_(('Cookie','info='+urllib.quote_plus(message))) Print bz2.decompress(urllib.unquote_plus(out)) Num, info = get_cookie_info(new_url + num) ![]() Info = urllib.unquote_plus(cookies.value) Opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))Ĭookies = cj.make_cookies(response, request)ĭigits = ''.join(re.findall(r'busynothing is (\d+)', text)) Import cookielib, urllib2, urllib, re, bz2, time, xmlrpclib What’s worse, this level connects other levels, which include level 4, 8 and 13. Cookielib is the new module that seems hard to understand. I am totally new to the the concept of Cookie and header. ‘Cookie’ clearly indicates to investigate what’s in level 4. This level is way too complicated than I thought. #data = urllib.urlretrieve(url, 'deltas.gz') Import urllib, Image, gzip, StringIO, difflibįin = gzip.GzipFile(fileobj=StringIO.StringIO(data)) ‘ ‘ means the string is common, ‘- ‘ means it’s unique in a and ‘+ ‘ means it’s unique in b.open() opens a file as a file object, to write to it use. list(difflib.ndiff(a, b)) converts the object to a list, in which each string has a ‘+ ‘, ‘- ‘ or ‘ ‘ at the start. ![]() difflib.ndiff(a, b) compares the two lists of strings and return a generator object(which generates delta lines). The most interesting module at this level is difflib. ![]() Some lines are same, and others are different. I was naive to think it’s just the subtraction of the two images, I should mock myself, I mean it’s level 18! ‘brightness.html’ leads to ‘deltas.gz’, and the unzipped file shows hex numbers in two parts. That being said, I decide to call a timeout, during which I will focus more on systematically learning Python. It’s getting too much for me as a Python beginner. This doesn’t help much regarding learning Python, and as the levels go up it takes more and more time to just figure out how the answers work. On one hand I got exposed to new stuff every level and learned a lot, on the other hand I am not really challenging myself, instead just googling and searching for answers. I have got mixed feelings about PythonChallenge. # if part.get_content_maintype() = 'audio': #data = base64.b64decode(msg.get_payload(0).get_payload()) #msg = ssage_from_file(open('19.txt'))ĭata = msg.get_payload(0).get_payload(decode=True) Import urllib, base64, wave, email, re, StringIO I am including some good alternative snippets that can get the job done. Combined with the ‘endian’ hint, a big endian. I was too unpythonic not realize using email and re module to get the base64 encoded message. A lot of info from the html, indian.wav file indicates wave module. I didn’t get the map part, it turns out to be a hint: ‘Indian’ just like ‘endian’.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |