Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Determine length of file in Python
Name: Birdman Date: December 29, 2004 at 10:21:37 Pacific OS: Mepis (2.6.7) CPU/Ram: 80x86
Comment:
I can't figure out how to get the length of a file in Python. The files I'm dealing with are relatively small, so I could read() the whole thing into a buffer then get len(buffer), but there must be an easier way. Google isn't helping, so I figured I'd ask here.
Name: Wolfbone Date: December 29, 2004 at 12:44:50 Pacific
Reply:
What's wrong with stat()? And what's wrong with Mepis - doesn't it provide the Python docs? If not, they are all available online at python.org, along with other resources.
0
Response Number 2
Name: Birdman Date: December 29, 2004 at 15:46:36 Pacific
Reply:
stat() is great! Nothing is wrong with MEPIS!
The Python docs make no reference to stat() under the file object IO sections... rather it is found (I went back and checked) under Chapter 6.1 (OS), section 4, "Files and Directories". When looking for information on reading and writing files, I went for the built in file object documentation, which makes no mention of anything in the os module. Seeing as the sections are quite interrelated, a link or two across would have been helpful!
Summary: I was trying to see if there is a method to count the number of files in a zip archive with out extracting it. I had a look at winzip's command line interface and there is a command for it but. wzunzi...
Summary: Hi all, I want to count the number of files in a directory from the command prompt in a windows system. The output shoudl just be the number and not the complete list of files. If i cant use a single ...
Summary: Could any body please help me on this...... I have to search count of files in a folder C:\Log\Staging I am using the below command in my batch file : for /F %%j in (`dir /A-D-H C:\Log\Staging^ | find...