day 13 python use json instead of eval
hat tip to benharri
This commit is contained in:
		
							parent
							
								
									10293ec22d
								
							
						
					
					
						commit
						6c175f2d8e
					
				@ -1,7 +1,8 @@
 | 
				
			|||||||
 | 
					import json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data = []
 | 
					data = []
 | 
				
			||||||
for chunk in open("input").read().split("\n\n"):
 | 
					for chunk in open("input").read().split("\n\n"):
 | 
				
			||||||
    data.append([eval(x) for x in chunk.splitlines(False)])
 | 
					    data.append([json.loads(x) for x in chunk.splitlines(False)])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def less(a, b):
 | 
					def less(a, b):
 | 
				
			||||||
    if type(a) == int and type(b) == int:
 | 
					    if type(a) == int and type(b) == int:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user