How to extract a word from text in Python
<p>I have this string <strong>"IP 1.2.3.4 is currently trusted in the white list, but it is now using a new trusted certificate."</strong> in a log file. What I need to do is look for this message and extract the IP address (1.2.3.4) from the log file.</p>

<pre><code>import os
import shutil
import optparse
import sys

def main():
    file = open("messages", "r")
    log_data = file.read()
    file.close()

    search_str = "is currently trusted in the white list, but it is now using a new trusted certificate."

    index = log_data.find(search_str)
    print index

    return

if __name__ == '__main__':
    main()
</code></pre>

<p>How do I extract the IP address? Your response is appreciated.</p>
