What dose (.*) mean in python?
Question: I was reading a learning python book, and this was in one of the examples so I
was wonder if this meant something.


Answer: (.*) doesn't mean anything specific in Python. However, it can mean specific
things to certain functions when a part of a string. Hence `'(.*)'` might mean
something to a function, although it means nothing to Python itself. Since

Two functions that do take strings containing (.*) are
[glob.glob](http://docs.python.org/library/glob.html),
[fnmatch.fnmatch](http://docs.python.org/library/fnmatch.html) and the re
modules functions.

In glob and fnmatch it is `'*'` that has special meaning, it means "anything".
You typically use it to match filenames:

    
    
    >>> import glob
    >>> glob.glob('/tmp/foobar.*')
    ['/tmp/foobar.tmp', '/tmp/foobar.txt', '/tmp/foobar.conf']
    

And you can also list everything with a specific ending:

    
    
    >>> import glob
    >>> glob.glob('/tmp/*.txt')
    ['/tmp/foobar.txt', '/tmp/frotz.txt', '/tmp/wfsh.txt']
    

Hence, in these modules `'(.*)'` would mean anything starts with (. and ends
with ) with anything in between it.

In the re module you handle regular expressions. regular expressions is a
highly magical text matching language. There `'.'` means "any character
(except newlines, unless you set a special flag to make it mean newlines as
well)", and '*' means "zero to infinite amount of repetitions of the previous
match". Hence `'.*'` means "pretty much anything", and is a common thing to
stick into regular expressions, as `'foobar.*'` would mean anything that start
with foobar.

Parenthesis means "groups", and to know what that mean you'll just have to
read the [documentation](http://docs.python.org/library/re.html). You probably
won't get it without some experimentation so you see what happens.

Basically '(.*)' matches anything. I'm assuming your regular expression has
text before and after it as well?

