What do I do to read html files on my pc?
Oscar Benjamin
oscar.j.benjamin at gmail.com
Tue Aug 28 08:31:52 EDT 2012
On Tue, 28 Aug 2012 03:09:11 -0700 (PDT), mikcec82
<michele.cecere at gmail.com> wrote:
> f = open(fileorig, 'r')
> nomefile = f.read()
> for x in nomefile:
> if 'XXXX' in nomefile:
> print 'NOK'
> else :
> print 'OK'
You don't need the for loop. Just do:
nomefile = f.read()
if 'XXXX' in nomefile:
print('NOK')
> **
> But this one works on charachters and not on strings (i.e.: in this
way I h=
> ave searched NOT string by string, but charachters-by-charachters).
Oscar
More information about the Python-list
mailing list