-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprintJSON.py
More file actions
35 lines (28 loc) · 1.18 KB
/
printJSON.py
File metadata and controls
35 lines (28 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
##
## Author: Emil Svendsen
## Date: 18/12-2018
## Last edit: 18/12-2018
import json
def constants():
with open("materials.json", "r") as material_file:
data = json.load(material_file)
for i in data['Constants']:
print(i, ":\n\tSymbol:", data['Constants'][i]['Symbol'], "\n\tValue:", data['Constants'][i]['Value'], "\n\tSI unit:", data['Constants'][i]['SI unit'])
def meterials():
with open("materials.json", "r") as material_file:
data = json.load(material_file)
for i in data['material']:
print(i, ":\n\tmu_0:", data['material'][i]['permeability'], "\n\tepsilon_0:", data['material'][i]['permittivity'])
def getMu_0():
with open("materials.json", "r") as material_file:
data = json.load(material_file)
return data['GetMu0AndEpsilon0']['Mu_0']
def getEpsilon_0():
with open("materials.json", "r") as material_file:
data = json.load(material_file)
return data['GetMu0AndEpsilon0']['Epsilon_0']
def getSpeedOfLight():
with open("materials.json", "r") as material_file:
data = json.load(material_file)
return data['Constants']['Speed of light in vacuum']['Value']