Files
PowerShell/demos/python/class1.py
T

19 lines
506 B
Python
Raw Normal View History

2016-08-03 14:49:35 -07:00
#!/usr/bin/python3
import json
# Define a class with a method that returns JSON
class returnsjson:
2019-02-04 22:06:08 -05:00
def __init__(self):
the_object = self
def method1(self):
2016-08-03 14:49:35 -07:00
return json.dumps(['foo',
{
'bar': ('baz', None, 1.0, 2),
'buz': ('foo1', 'foo2', 'foo3')
},
'alpha',
1,2,3])
c = returnsjson()
2019-02-04 22:06:08 -05:00
print(c.method1())