Re: parsing text from a file

2009-01-30 Thread John Machin
On Jan 30, 7:39 pm, Tim Golden wrote: > Wes James wrote: > > 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

Re: parsing text from a file

2009-01-30 Thread Tim Golden
Wes James wrote: 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|" Watch out. .reg

Re: parsing text from a file

2009-01-29 Thread MRAB
Wes James wrote: 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

Re: parsing text from a file

2009-01-29 Thread Tim Chase
if s.find('LANDesk') <0: is True for a line which doesn't contain "LANDesk"; if you want the opposite, try if s.find('LANDesk') >-1: Or more pythonically, just use if 'LANDesk' in s: -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing text from a file

2009-01-29 Thread John Machin
On Jan 30, 8:54 am, Wes James wrote: > 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

Re: parsing text from a file

2009-01-29 Thread Vlastimil Brom
2009/1/29 Wes James : > If I read a windows registry file with a line like this: > ... > > with this code: > > f=open('fwrules.reg2.txt') > > for s in f: > if s.find('LANDesk') <0: >print s, > > > LANDesk is not found. > > how do I find LANDesk in a string like this. is the "\\" messing thing

parsing text from a file

2009-01-29 Thread Wes James
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