parsing text from a file
Wes James
comptekki at gmail.com
Thu Jan 29 16:54:34 EST 2009
If I read a windows registry file with a line like this:
"{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted
Multicast|Edge=FALSE|"
with this code:
f=open('fwrules.reg2.txt')
for s in f:
if s.find('LANDesk') <0:
print s,
LANDesk is not found.
Also this does not work:
for s in f:
try:
i=s.index('L')
print s[i:i+7]
except:
pass
all it prints is "LAND"
how do I find LANDesk in a string like this. is the "\\" messing things up?
thx,
-wj
More information about the Python-list
mailing list