I'm having an issue returning my function when trying to load a JSON file. Here is the code to look at.
#!/usr/bin/python
import os
import json
class Math(object):
def __init__(self):
self.__mathjsonfile__ = os.path.join(os.getcwd(),os.path.dirname(__file__),'server','json_data','math.json')
def load_mathfile(self):
with open(self.__mathjsonfile__) as i:
data = i.read()
math_data = json.loads(data)
self.math_data = math_data
def read_mathdata(self):
for numbers in self.math_data['numbers']:
print numbers['zero']
for symbols in self.math_data['symbols']:
print symbols['percent']
start = Math()
start.read_mathdata()
I've ended the last function with ()
because I can't seem to end read_mathdata
with return
and still print the JSON information.