Skip to main content

PYON Reader - Python Object Notation

Project description

pyon

PYON Reader - Python Object Nation

Table of Contents

Installation

pip install pyonr

How to use

Creating PYON file

let's create our PYON file, i'm going to call it friends.pyon

{
    "me": {
        "name": "Nawaf",
        "age": 15
    }
}

Reading File

import pyonr

file = pyonr.read('friends.pyon') # Replace "friends.pyon" with your file name

fileData = file.read # {'me': {'name': 'Nawaf', 'age': 15}}
type(fileData) # <class 'dict'>

Writing File

import pyonr

file = pyonr.read('friends.pyon')
fileData = file.read

fileData['khayal'] = {
    "name": "Khayal",
    "age": 14
}
# This will update "fileData" only, we need to save it

file.write(fileData)

File will get updated too

{
    'me': {
        'name': 'Nawaf',
        'age': 15
        },

    'khayal': {
        'name': 'Khayal',
        'age': 14
    }
}

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

pyonr-2.1.7.tar.gz (6.0 kB view hashes)

Uploaded Source

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