I have a Python program to run in command line. It has a `'-d'` option to take a directory name after it, like this:

```
foo.py -d dir_name

```

But when I run this on a directory containing empty space in the dir\_name, like:

```
foo.py -d C:/My Folder/hello

```

it splits into two parts before and after the space.

My code uses the `getopt` function to parse the command line options:

```
try:
    opts, args = getopt.getopt(sys.argv[1:], "d:")
except getopt.GetoptError:
    print('foo.py -d <dir_name>')
    sys.exit(1)

for opt, arg in opts:
    if opt in ('-d',):
        dir_name = arg
        do_all(dir_name)

```

The variable `dir_name=C:/My` instead of `C:/My Folder/hello` after this. So how can I do it?