Anthony Papillion <anth...@cajuntechie.org> writes:

> I have a function I'm writing to delete wildcarded files in a
> directory.

Is the brute-force method (explicit, easy to understand) good enough?

    import os
    import os.path
    import glob

    paths_to_remove = glob.glob(
            os.path.join([
                os.path.expanduser("~anthony"), "backup", "unix*"
                ]))
    for path in paths_to_remove:
        os.remove(path)

-- 
 \           “In case you haven't noticed, [the USA] are now almost as |
  `\     feared and hated all over the world as the Nazis were.” —Kurt |
_o__)                                                   Vonnegut, 2004 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to