FAQ
Works well in Unix but I'm making a script that works on both
Unix and Windows.

Win doesn't have that 'file -bi' command.

"bromden" <bromden at gazeta.pl.no.spam> wrote in message
news:bhd559$ku9$1 at absinth.dialog.net.pl...
How can I check if a file is binary or text?
import os
f = os.popen('file -bi test.py', 'r')
f.read().startswith('text')
1

(btw, f.read() returns 'text/x-java; charset=us-ascii\n')

--
bromden[at]gazeta.pl

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 25 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 13, '03 at 8:29a
activeAug 16, '03 at 2:27a
posts25
users12
websitepython.org

People

Translate

site design / logo © 2022 Grokbase