Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8263337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:04:00+00:00 2026-06-08T04:04:00+00:00

My program reads a field like *ABC* and tries to convert it into a

  • 0

My program reads a field like *ABC* and tries to convert it into a glob statement.
I am having issues when trying to restrict the data.
Glob doesn’t work the same in linux bash vs python glob library:

From bash:

bash_level$ ls *FOO*V7*
baz_FOO_V7.txt  baz_FOO_V777.txt 
bash_level$ ls *FOO*V7[![:digit:]]* 
baz_FOO_V7.txt

From ipython:

In [1]: import glob
In [2]: glob.glob("*FOO*V7*.txt")
Out[2]: ['baz_FOO_V7.txt', 'baz_FOO_V777.txt']
In [3]: glob.glob("*FOO*V7[![:digit:]]*.txt")
Out[3]: []

Bottom line:
Out[3] hasn’t the same expected output.
How can I overcome this issue?

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:04:01+00:00Added an answer on June 8, 2026 at 4:04 am

    You could translate your glob expression into a regular expression:

    import re
    regex=re.compile(r'.*FOO.*V7[^\d].*\.txt')
    print filter(lambda x: regex.match(x), glob.glob("*"))
    

    Of course, at this point you no longer need glob as you could use os.listdir() instead.

    EDIT

    Reading the docs for glob and fnmatch (which is what glob uses to do matching), it appears that your match could be written as:

    glob.glob('*FOO*V7[!0123456789]*')
    

    as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that reads data from a file line-by-line. I would like
This program reads emails (really just a .txt file structured like an email) and
I have a program that reads input from a file. I am trying to
I'm trying to access some Ghostscript functions like so: [DllImport(@C:\Program Files\GPLGS\gsdll32.dll, EntryPoint = gsapi_revision)]
I've been trying to figure out what computer field I want to go into
I am working on a simple program that collects data from the field on
For this program i have only used field separators from data files in shell
I have the following data frame (info) that looks like this: > info[1:5,] field
My SSIS program reads as input from a .csv file. The file has about
Below is the program that I wrote. /******************************************************************************* * This program reads EOF from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.