with open('save.txt', 'r') as fname:
data = fname.readlines()
print(data)
x = str(data)
if x.isspace():
print("only whitespaces")
else:
print("not only whitespaces")
I have tried this but it seems it doesnt work. I want to detect if a txt file only contains whitespaces and also /n
if it is possible.