Q. Write a Python program to display the size of a file after removing EOL characters, leading and trailing white spaces and blank lines.

 

Answer = 

 

f1 = open("path.txt",'r')

data = f1.readlines()
content = ""
for i in data :
    for j in i :
        if j.isalnum():
            content += j

print("file size:-",len(content),"bits")
    
f1.close()


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post