Skip to main content

C2D

optimal solution to read and save a config file.

Install

pip install C2D

Usage

  1. Import C2D
from C2D import C2D
  1. Create object
config=C2D.C2D()
  1. Create config.ini
from C2D import C2D

key={'section': {'name': 'c2d',
                'version': '1.0'
                },
      'install': {'date': '23/12/2019'}
    }
# Create C2D Object      
config=C2D.C2D(keys=key)
#This will Save config.ini file
config.Save()

if you want to give custom file NAME

config=C2D.C2D(file='Test.ini',keys=key)
  1. Read Config File
from C2D import C2D
config=C2D.C2D()
keys_values=config.Read()
print(keys_values)

Output {'section': {'name': 'c2d', 'version': '1.0'}, 'install': {'date': '23/12/2019'}}

To Read a Custom file

config=C2D.C2D(file='Test.ini')
  1. Read All Sections
from C2D import C2D
config=C2D.C2D()
config.Read()
print(config.Sections())

Output ['section', 'install']

  1. Read Values By Section Name
from C2D import C2D
config=C2D.C2D()
config.Read()
print(config.Values('install'))

Output {'date': '23/12/2019'}

Help

>>> help(C2D)
Help on module C2D.C2D in C2D:

NAME
  C2D.C2D

CLASSES
  builtins.object
      C2D

  class C2D(builtins.object)
   |  C2D(file='config.ini', keys=None, sep='=')
   |  
   |  C2D is an class for creating and reading config.ini files.
   |  
   |  Create Object:
   |  -------------
   |      obj=C2D(file='config.ini',keys=None,sep='=')
   |  
   |      Parameter:
   |      ---------
   |          file: optional,any File name ,default file name is config.ini
   |          sep : optional,separator,defualt separator is =
   |          key : optional,an Dictionary object
   |  
   |          key={
   |                'section': {
   |                  'name': 'c2d',
   |                  'version': '1.0'
   |                },
   |                'install': {
   |                  'date': '23/12/2019'
   |                }
   |              }
   |  Methods:
   |  -------
   |      obj.Save()    : save config file
   |      obj.Read()    : read config file and return config dict object.
   |      obj.Sections(): list of section in config.ini
   |      obj.Values()  : all avialable paramters and Values

Release files for C2D 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for C2D 0.0.2
File Size Uploaded
C2D-0.0.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for C2D 0.0.2
File Interpreter ABI Platform
C2D-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / C2D-0.0.2.tar.gz

Download URL C2D-0.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11e824269cda6a9ee02888df18d86bbc7dde9cb8551ac8be661358390395f7b3
BLAKE2b-256 checksum
How to use checksums
8f6e66b076f9a5177451b7f6e6c9ad2eaddc2fd30fd6be27f59c13c9fb2e35e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

Release files / C2D-0.0.2-py3-none-any.whl

Download URL C2D-0.0.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
529f238d068b437dc679bfe106bb4b5c06e7279346d3218dfadfe71ec425f3ac
BLAKE2b-256 checksum
How to use checksums
f71bc1e2ebb29464febdd01ddeee82507d21811b6e0a7ef25e51485e6a3f3543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page