PyBase is a python module to allow the storage of variables or other
description and use of PyBase
To install the package :pip install PyBase-manager
introduce your code by :
from PyBase import *
These functions are both unnecessary and mandatory.
The first :
(obj).getData("myfile")
It plays the role of dataName = open(myfile.txt, "at") and therefore can easily be replaced by it, but one of the two is required.
Warning : Do not give the file extension (here .txt) It will not be able to find it.
The second :
(obj).showData(data)
the only purpose of this function is to display the complete contents of what has been recorded by PyBase
The record base functions from table and in its tables one and/or contents. So there are the functions related to the tables and those related to the contents
newTab()
(obj).newTab(data, "Name")
1 checks if the table already exists and if it already exists he does not recreate it. 2 does not care if a table of the same does not exist or not, can be dangerous because when deleting one of the tables, the 2 will be.
delTab()
(obj).delTab(data, "Name")
This function allows you to delete a complete table and with it are contained
Here the 'Name' table will be deleted.
appendTab()
(obj).appendTab(data, "Name", "Andrew")
This function allows to add to a table (here 'Name') content (here 'Andrew')
The result in the file:
tN::Name : {Andrew}
findTab()
(obj).findTab(data, "Hello world")
This boolean function only allows you to search for a table in the database, it returns True if the table exists.Here we search for 'Hello world' among 'data'
getCont()
(obj).getCont(data, "Name")
Allows to retrieve the contents of a table Here the table 'Name'
delCont()
(obj).delCont(data, "Name", "Joseph")
Deletes a particular content in a particular table Here, delete 'Joseph' in table 'Name'
replaceCont()
(obj).replaceCont(data, "Name", "Chloé")
replaces all the existing content of a table with the given content Here, replace the contents of 'Name' by 'Chloe'.The constructor used is by default
obj = PyBase.PyBase()
As well as 'data' comes from
data = obj.getData("myfile")
The PyBase.py python isn't yet commented but it will be soon ;)