Why is this program for extracting IDs from a file so slow?
You said in comments that you don't know how to create a self-contained test case. But that's really easy! All that's needed is a function like this:

def test_case(filename, n):
    """Write n lines of test data to filename."""
    with open(filename, 'w') as f:
        for i in range(n):
            f.write('Mon-{0:06d} {1}\n'.format(i + 1, '  99.999' * 20))


You can use this to make a test case of about the right size:

&gt;&gt;&gt; test_case('cr36275.data', 200000)
&gt;&gt;&gt; import os
&gt;&gt;&gt; os.stat('cr36275.data').st_size
34400000


That's about 34 MiB so close enough. Now we can see how fast your code really is, using the timeit module:

&gt;&gt;&gt; from timeit import timeit
&gt;&gt;&gt; timeit(lambda:pullIDs('cr36275.data'), number=1)
1.3354740142822266


Just over a second. There's nothing wrong with your code or the speed of Python.

So why does it take you many minutes? Well, you say that you're running it inside Emacs. That means that when you run

&gt;&gt;&gt; pullIDs('cr36275.data')


Python prints out a list of 200,000 ids, and Emacs reads this line of output into the *Python* buffer and applies syntax highlighting rules to it as it goes. Emacs' syntax highlighting code is designed to work on lines of source code (at most a few hundred characters but mostly 80 characters or less), not on lines of output that are millions of characters long. This is what is taking all the time.

So don't do that. Read the list of ids into a variable and if you need to look at it, use slicing to look at bits of it:

&gt;&gt;&gt; ids = pullIDs('cr36275.data')
&gt;&gt;&gt; ids[:10]
[['Mon-000001'], ['Mon-000002'], ['Mon-000003'], ['Mon-000004'], ['Mon-000005'],
 ['Mon-000006'], ['Mon-000007'], ['Mon-000008'], ['Mon-000009'], ['Mon-000010']]