Created
June 20, 2017 01:20
-
-
Save the5fire/d2d1fe3ec1408ba1e70bf68d791e0183 to your computer and use it in GitHub Desktop.
Revisions
-
the5fire revised this gist
Jun 20, 2017 . No changes.There are no files selected for viewing
-
the5fire created this gist
Jun 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # coding:utf-8 data = """ 1)1) (integer) 4 2) (integer) 1332222 3) (integer) 13 4) 1) "SET" 2) "database" 3) "Redis" 2)1) (integer) 4 2) (integer) 1332222 3) (integer) 13 4) 1) "SET" 2) "database" 3) "Redis" """ commands = [] params = [] for line in data.split('\n'): if line.strip(): if not line.startswith(' ') and params: commands.append(params[:]) params = [] params.append(line.split(')')[-1]) commands.append(params) print commands