Created
February 1, 2019 09:06
Revisions
-
codeAshu created this gist
Feb 1, 2019 .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 @@ import json input_ls = [] f = open('inputTraining.txt') for line in iter(f): try: input_ls.append(json.loads(line)) except ValueError: print line +'is not a proper json line' f.close() nCount = input_ls[0] input_ls = input_ls[1:] if len(input_ls) != nCount : print 'Data is not correct, pls check!' calvin = [] hobbes = [] for c in input_ls: calvin.append(c.get('calvin')) hobbes.append(c.get('hobbes')) target = [] f = open('outputTraining.txt') for line in iter(f): line = line.replace('\n','') target.append(line) f.close() print len(target)