Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60841

Checking Common File Types

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jadec375@msn.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'filename': 0.09; 'jpg': 0.09; 'python': 0.11; 'def': 0.12; 'attempted': 0.16; 'direction?': 0.16; 'skip:{ 30': 0.16; 'subject:File': 0.16; 'trying': 0.19; 'to:name:python-list@python.org': 0.22; 'print': 0.22; "aren't": 0.24; 'tells': 0.24; 'file.': 0.24; "i've": 0.25; 'script': 0.25; 'point': 0.28; "i'm": 0.30; 'file': 0.32; 'basic': 0.35; 'common': 0.35; 'but': 0.35; 'checks': 0.38; 'to:addr :python-list': 0.38; 'files': 0.38; 'little': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'first': 0.61; 'from:addr:msn.com': 0.97
X-TMN [MFhw/lJ/kflWH1J+PFbbtcpRBsdi7d5P]
X-Originating-Email [jadec375@msn.com]
Content-Type multipart/alternative; boundary="_f50a5216-a205-4a31-829c-e937f2ea762f_"
From jade <jadec375@msn.com>
To "python-list@python.org" <python-list@python.org>
Subject Checking Common File Types
Date Sun, 1 Dec 2013 18:27:16 +0000
Importance Normal
MIME-Version 1.0
X-OriginalArrivalTime 01 Dec 2013 18:27:16.0582 (UTC) FILETIME=[F66E6860:01CEEEC2]
X-Mailman-Approved-At Sun, 01 Dec 2013 22:55:11 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3444.1385934912.18130.python-list@python.org> (permalink)
Lines 61
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385934912 news.xs4all.nl 15985 [2001:888:2000:d::a6]:37704
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60841

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello, 
I'm trying to create a script that checks all the files in my 'downloaded' directory against common file types and then tells me how many of the files in that directory aren't either a GIF or a JPG file. I'm familiar with basic Python but this is the first time I've attempted anything like this and I'm looking for a little help or a point in the right direction? 

file_sigs = {'\xFF\xD8\xFF':('JPEG','jpg'),  '\x47\x49\x46':('GIF','gif')}
def readFile():    filename = r'c:/temp/downloads'      fh = open(filename, 'r')     file_sig = fh.read(4) print '[*] check_sig() File:',filename #, 'Hash Sig:', binascii.hexlify(file_sig) 
RegardsJade



 
  		 	   		  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Checking Common File Types jade <jadec375@msn.com> - 2013-12-01 18:27 +0000

csiph-web