Ad:
 
  • Python Discussion Thread
  • Unsolved
  • Views: 54833
  • Python RSS
Similar Threads
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?
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. Perhaps start a new thread 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
Build Custom RSS Feed


Follow us on Twitter


© 2010 DaniWeb® LLC