Code: Alles auswählen
('foo', 'bar', 'baz')
Code: Alles auswählen
#!/usr/bin/env python
class A:
def __init__(self, b, c, d):
self.b = b
self.c = c
self.d = d
def create(data) -> list:
components = []
for n in data:
a = A(*n)
components.append(a)
return components
def main():
data = [
('foo', 'bar', 'baz'),
('other foo', 'other bar', 'other baz'),
('foo', 'bar', 'baz'),
('another foo', 'another bar', 'another baz')
]
result = create(data)
if __name__ == '__main__':
main()