Der Titel sagt ja schon alles.
Warum akzeptiert Python nur str() und kein int(), wenn ich mit with open("datei", "w") in eine Datei schreiben will ?
Also z.B.:
und
Code
test = int(psutil.cpu_percent(5))
with open("/dev/shm/datei.txt", "w") as datei:
datei.write(str(test))
Aber nicht als datei.write(int(test))