Ok, one TypeError more. Here is my code:
class musssein:
def notwendig(self, name):
self.name = name
all = [] # fuer jede Eigenschaft eine extra Liste
day = []
time = []
prize = []
what = []
kategorie = []
with open(name) as f:
for line in f:
data = line.replace('\n','') #Umbruchzeichen ersetzen
if data != ' ': # immer nur bis zur neuen Zeile bzw. bis zum ' ' lesen
all.append(data) # in liste einfuegen
else:
kategorie.append(all.pop())
what.append(all.pop())
prize.append(all.pop())
time.append(all.pop())
day.append(all.pop())
def anzeige():
musssein.notwendig('schreiben.txt')
print table.Table(
table.Column('Datum', day),
table.Column('Kategorie', kategorie),
table.Column('Was?', what),
table.Column('Preis', prize, align=table.ALIGN.LEFT))
The description is in german, but it explain me just what you probably already know.
When I run now anzeige()
, the terminal shows me only:
File "test.py", line 42, in anzeige
musssein.notwendig('schreiben.txt')
TypeError: unbound method notwendig() must be called with musssein instance as first argument (got str instance instead)
I tried many possibilities and read a lot of other threads, but I didn't find the right one which explained it.