Skip to main content

A library to read data from a file and convert it into python dictionary

Project description

Installation

pip install Dift

Introduction

Dift is a python library that allows you to read data from a file and convert it into a dictionary that can be used by your Python script, and it can be configured to your needs

Usage

You can import Dift into your script by adding import Dift To read a data from a file you can use the readData() function The readData() function takes one main arguments and three optional arguments

1.file

the main argument that readData() function takes is the file to read the data fron and the file should be like this

Student's Name : Alex Corey
Mother's Name : Branda Corey
Father's Name : John Corey

And the it doesn't require "" to set the name of the key and its syntax can be customized Example of code using the readData() function

import Dift
file = open('details.txt','r')
dict = Dift.readData(file)

2.ctype

This is an optional argument that you can enable to store int values as int and disable to store int values as str in the dictionary Enabled by default

Example:-

d = readData(file,ctype=False)

3.seperator

It is a string argument which requires a sign to be used by the library to seperate keys from values the default is :

d = readData(file,seperator=":")

4.ignore

This optional arguments is used to enable or disable the error that occurs when you didn't used the right seperator in the file True by default


d = readData(file,ignore=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dift-0.0.2.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

dift-0.0.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page