Rick Johnson <rantingrickjohn...@gmail.com> writes: >> There is now also a line that starts with: PCH_CPU_TEMP: >> And I do not want that one. > > Yes. But be aware, that while the `str.startswith(target)` > method is indeed more efficient than a more generalized > "inclusion test", if the target is not _always_ at the > beginning of the string, then your code is going to skip > right over valid match like a round stone skipping across > the surface of a glass-smooth lake. But if you are sure the > target will always be at the beginning of the string, then > it is the best choice.
Yes, I am sure it is always at the beginning of the line. (It is output from the Linux sensors command.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list