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 7874947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:54:02+00:00 2026-06-03T02:54:02+00:00

Problem: In my D:/collection folder, I have two types of files, that are 8-digit-number_type.dbf

  • 0

Problem:

In my “D:/collection” folder, I have two types of files, that are “8-digit-number_type.dbf” and “character_type.dbf” as follows: 00093282.dbf, 00345602.dbf, 69209340.dbf, 69806980.dbf, 92406482.dbf, 93609360.dbf,…, aaa.dbf, bbb.dbf,….

Objective:

I want to take only the “8-digit-number_type.dbf” files, and exclude the “character_type.dbf” files from my analysis. I don’t care about the “character_type.dbf” files. Then, I’d like to split the 8 digits into two 4-digit values. So, a listing file(say,list.txt) with two columns should look like the following:

0009 3282
0034 5602
6920 9340
6980 6980
9240 6482
9360 9360
....

And these values should be stored as character type.

How can I implement that in Python? Thank you.

Sincerely,
Bill TP

  • 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-03T02:54:03+00:00Added an answer on June 3, 2026 at 2:54 am
    >>> import os
    >>> paths = ['00093282.dbf', '00345602.dbf', '69209340.dbf', '69806980.dbf', '92406482.dbf', '93609360.dbf','aaa.dbf', 'bbb.dbf']
    >>> for path in paths:
            file_name,ext = os.path.splitext(path)
            if file_name.isdigit():
                print '{0} {1}'.format(file_name[:4],file_name[4:])
    
    
    0009 3282
    0034 5602
    6920 9340
    6980 6980
    9240 6482
    9360 9360
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with redirect to protected folder. There are two domains: domain1.com
I have a problem adding entities to a collection. public void SaveNotificationUsergroups(int bookingobjectID, int[]
We have a problem with the usage of generics. We have a generic collection
Background I have a TreeView that follows the MVVM design pattern and supports multiple
So, my problem is the following: I have a mail client that I wrote
I've been experimenting with ASP.Net MVC, and have come across a problem that is
I have wcf service that twice a minute check %programdata%/MYAPP folder and send all
My problem is: There is a collection of users. Im trying to find, does
Problem: The data I'm trying to display is essentially a collection of collections of
I seem to be running into a problem with temp table garbage collection: CREATE

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.