(Dec-01-2016, 11:04 PM)wrestlemy69 Wrote: I do not understand what that line (19 and 23) does. Is there a program that translate code to English? lol.Python has interactive interpreter where you can test stuff out.
Here i just paste in line 19.
>>> gameid = header[:6] Traceback (most recent call last): File "<string>", line 301, in runcode File "<interactive input>", line 1, in <module> NameError: name 'header' is not defined #Fix it >>> header = 'Hello world' >>> gameid = header[:6] >>> gameid 'Hello ' >>> header[6:11] 'world'[:6] is Slice notation sequence[start:stop:step]
Line 23:
>>> import re >>> gameid = 'hello world' >>> match = re.search(r'\w+', gameid) >>> match <_sre.SRE_Match object; span=(0, 5), match='hello'> >>> bool(match) True >>> if match: ... print('if True i run') ... if True i runIt's a good tool to use,and you can use it when you study the basic of Python.