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
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,
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
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 is scan a
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 in it that
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 ecodings defined at the
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 scripts. What I'd like
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 like to do is
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
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
In [EMAIL PROTECTED], Tim Arnold wrote:
snip
Untested:
import os, sys, codecs
def checkfile(filename):
f = codecs.open(filename,encoding='ascii')
try:
for num, line in enumerate(f):
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:
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 =
[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 about
13 matches
Mail list logo