bg_ie wrote:
> What I'd like to do is scan a directory and list all the
> files in it that contain a non ascii character.
Not quite sure what your intention is. If you're planning a one-time scan
of a directory for non-ASCII characters in files, so that you can manually
fix those files up, then t
[EMAIL PROTECTED] wrote:
> I'm updating my program to Python 2.5, but I keep running into
> encoding problems. I have no ecodings defined at the start of any of
> my scripts. What I'd like to do is scan a directory and list all the
> files in it that contain a non ascii character. How would I go ab
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In <[EMAIL PROTECTED]>, Tim Arnold wrote:
>
>> Here's what I do (I need to know the line number).
>>
>> import os,sys,codecs
>> def checkfile(filename):
>> f = codecs.open(filename,encoding='ascii')
>>
>>
Tim Arnold schrieb:
> That looks much cleaner. I didn't know the 'num' from the enumerate would
> persist so the except block could report it.
It's indeed guaranteed that the for loop index variables will keep the
value they had when the loop stopped (either through regular
termination, break, or
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In <[EMAIL PROTECTED]>, Tim Arnold wrote:
>
> Untested:
>
> import os, sys, codecs
>
> def checkfile(filename):
>f = codecs.open(filename,encoding='ascii')
>
>try:
>for num, line in enu
In <[EMAIL PROTECTED]>, Tim Arnold wrote:
> Here's what I do (I need to know the line number).
>
> import os,sys,codecs
> def checkfile(filename):
> f = codecs.open(filename,encoding='ascii')
>
> lines = open(filename).readlines()
> print 'Total lines: %d' % len(lines)
> for i in
"Peter Bengtsson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
>> Hi,
>>
>> I'm updating my program to Python 2.5, but I keep running into
>> encoding problems. I have no ecodings defined at the start of any of
>> my scripts. What I'd l
On Feb 24, 2:44 am, Larry Bates <[EMAIL PROTECTED]> wrote:
> Peter Bengtsson wrote:
> > On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
> >> Hi,
>
> >> I'm updating my program to Python 2.5, but I keep running into
> >> encoding problems. I have no ecodings defined at the start of any of
> >> my scrip
On Feb 24, 2:35 am, "John Machin" <[EMAIL PROTECTED]> wrote:
> On Feb 24, 2:12 am, "Peter Bengtsson" <[EMAIL PROTECTED]> wrote:
>
> > On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
>
> > > Hi,
>
> > > I'm updating my program to Python 2.5, but I keep running into
> > > encoding problems. I have no ec
Peter Bengtsson wrote:
> On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
>> Hi,
>>
>> I'm updating my program to Python 2.5, but I keep running into
>> encoding problems. I have no ecodings defined at the start of any of
>> my scripts. What I'd like to do is scan a directory and list all the
>> files
On Feb 24, 2:12 am, "Peter Bengtsson" <[EMAIL PROTECTED]> wrote:
> On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
>
> > Hi,
>
> > I'm updating my program to Python 2.5, but I keep running into
> > encoding problems. I have no ecodings defined at the start of any of
> > my scripts. What I'd like to do
On Feb 23, 2:38 pm, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm updating my program to Python 2.5, but I keep running into
> encoding problems. I have no ecodings defined at the start of any of
> my scripts. What I'd like to do is scan a directory and list all the
> files in it that contain a non ascii
Hi,
I'm updating my program to Python 2.5, but I keep running into
encoding problems. I have no ecodings defined at the start of any of
my scripts. What I'd like to do is scan a directory and list all the
files in it that contain a non ascii character. How would I go about
doing this?
Thanks,
Ba
13 matches
Mail list logo