Programming Examples
Python program to display the size of a file in byte
Write a program to display the size of a file in byte
Solution
fname=input("Enter the file name : ")
fp=open(fname,"r")
data=fp.read()
size=len(data)
print("Size of file in Byte : ",size)
fp.close()
Output/ Explanation:
Enter the file name : myfile.txt
Size of file in Byte :Â 124