GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Defendi/pyFixedWidthDataFile: Python3 Lib for create Fixed-width Data File

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
pyFixedWidthDataFile
pyFixedWidthDataFile
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

Fixed Width Data File Creator

This is a simple library for creating fixed-width text data files or text files (txt or csv) separated by a certain separator character.

You can use it to exchange data between APIS and other applications.

Installation

To install the package, just run the command below:

pip install pyFixedWidthDataFile

Usage

  1. Instantiate the class:

from pyFixedWidthDataFile import FWDataFile app = FWDataFile(path_to_specs_folder, optional_separator)

  • path_to_specs_folder: Path to the folder containing the Specs Files;
  • optional_separator: Separation character between fields (optional)
  1. Specs Files: Files, JSON standard, with specifications of the fields contained in the lines (records).

see example in tests/specs

Open the record with "{", enter the name clause, it is mandatory. Open the list of objects of type field with "fields {", enter the id of the field and enter the characteristics of the field.

Characteristics List

  • name: (required) name of the field
  • start_pos: (required) starting position
  • end_pos: (required) end position
  • format: (required) field type, which can be:
  1. alpha: alphanumeric, text
  2. num: numeric (integer, floating point)
  • default: (optional) default value of the field, if there is no default value the field will not be filled with spaces, even if it is numeric.
  • decimals: (optional) only for numeric fields, number of decimal places
  • ignore: (optional) field to be ignored
  • required: (optional) mandatory field
  • regex: (optional) regular expression operations field
  1. Inject the lines from the file:

app.append_line("header",cod_client="1234",name_client="Alexandre Defendi")

  1. use the result:

print(app)

"R000001PED1234 Alexandre Defendi X"

License

This project is under the MIT license. See the LICENSE file for more details.

About

Python3 Lib for create Fixed-width Data File

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.