942,515 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 82814
  • Python RSS
May 18th, 2007
1

Question to get file Size

Expand Post »
so when i run this in python interpiter it works
Python Syntax (Toggle Plain Text)
  1. >>> import os
  2. >>> b= os.path.getsize("/path/isa_005.mp3")
  3. >>> b
  4. 2071611L
  5. >>>
but when i run it in a script

Python Syntax (Toggle Plain Text)
  1. b= os.path.getsize("/path/isa_005.mp3")
  2. FILE.writelines(b)
i get an error.
any one know how i can get it to print the size of the file as text?
Similar Threads
Reputation Points: 23
Solved Threads: 1
Newbie Poster
lineman60 is offline Offline
5 posts
since May 2007
May 18th, 2007
0

Re: Question to get file Size

str() is your friend.
Python Syntax (Toggle Plain Text)
  1. FILE.writelines( str(b) )
Reputation Points: 19
Solved Threads: 58
Junior Poster
mawe is offline Offline
133 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: RPS- Tuple Fun!!
Next Thread in Python Forum Timeline: Problem with wx.TreeCtrl





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC