954,202 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Question to get file Size

so when i run this in python interpiter it works

>>> import os
>>> b= os.path.getsize("/path/isa_005.mp3")
>>> b
2071611L
>>>

but when i run it in a script

b= os.path.getsize("/path/isa_005.mp3")
FILE.writelines(b)

i get an error.
any one know how i can get it to print the size of the file as text?

lineman60
Newbie Poster
5 posts since May 2007
Reputation Points: 23
Solved Threads: 1
 

str() is your friend.

FILE.writelines( str(b) )
mawe
Junior Poster
133 posts since Sep 2005
Reputation Points: 19
Solved Threads: 58
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You