How to use a regexp here
Cecil Westerhof
Cecil at decebal.nl
Mon Dec 4 07:13:53 EST 2017
More information about the Python-list mailing list
Mon Dec 4 07:13:53 EST 2017
- Previous message (by thread): How to use a regexp here
- Next message (by thread): Blog for basic python programming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ned Batchelder <ned at nedbatchelder.com> writes: > On 12/4/17 4:36 AM, Cecil Westerhof wrote: >> I have a script that was running perfectly for some time. It uses: >> array = [elem for elem in output if 'CPU_TEMP' in elem] >> >> But because output has changed, I have to check for CPU_TEMP at the >> beginning of the line. What would be the best way to implement this? >> > > No need for a regex just yet: > > array = [elem for elem in output if elem.startswith('CPU_TEMP')] Yes, that is it. I should have known that. :'-( -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
- Previous message (by thread): How to use a regexp here
- Next message (by thread): Blog for basic python programming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list