Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PyTool-Kit

PyTool-Kit is an Python tools. It contain many usefull Tools

what is Pytool-kit

PyTool-kit , its has Many tool for Python. This tool is use in everytime in Program(Python). But import this module for this and " make progam small and easy to Understand"

Installation

Open CMD

pip install pytool_kit

sudo pip3 install pytool_kit

Tools/Function

Note:- Before use import moduls like below way :

import pytool_kit as kit

get_txt_between

This tool is use For, Get txt/string between the txt/string from txt/string that we want ...

Example

This string(or txt) From Terminal (ifconfig)

inet6 fe80::d0f1:608c:a48b:5ab  prefixlen 64  scopeid 0x20<link>
inet 192.168.x.x  netmask 255.255.255.0  broadcast 192.168.0.255
ether 70:f1:a1:de:06:00  txqueuelen 1000  (Ethernet)

From above txt File we Want ip address in 2 second Line , we Known that ip is between inet & netmask

parse1 = "inet" 
parse2 = "netmask"
text_var = txt/string 
kit.get_txt_between(text_var,parse1,parse2)

output

192.168.x.x

add_txt_between

this tool use for , txt(string) add in txt(string) or replace

example

txt = "Ben is an Girls who live in his "

now we add or replace Girls By boy is between a " is an " and is an is an " "who live

parse1 = "is an" 
parse2 = "who live"
text_var = txt/string 

#add/replace

kit.add_txt_between(txt,"boy",parse1,parse2) 
>>>Ben is an boy who live in his


#replace txt from parse2 to end as "add this from kit" (parse2=" ")

kit.add_txt_between(txt,"add this from kit ",parse1, " ")
>>>Ben is an girls add this from kit


#replace txt starting to parse1 to "add this from kit" and parse2 as it is(parse1=" ")

kit.add_txt_between(txt,"add this from kit ",parse1, " ")
>>>Ben is an girls add this from kit

txt2array

This tool is convert it convert txt to array

Example

string = "Python is an interpreted high-level general-purpose programming language"

now it convert to array

kit.txt2array(string)
>>>{'Python', 'is', 'an', 'interpreted', 'high-level', 'general-purpose', 'programming', 'language'}

array2txt

this tool is use from convert Array to Txt(string)

Example

array_test = {'A', 'computer', 'is', 'a', 'machine'}

now, It convert to simple txt or (string)

kit.array2txt(array_test)
>>>A computer is a machine 

array2dic

This tools use for Convet Two array to one Python Dictory

Example

Name = ["Prajwal", "Ram" , "Rohit" , "Subodh" ,"Pratham"]
Marks =[95,68,58,81,70]

There are Two array (Name and Marks) than convert To Dictory

kit.array2dic(Name,Marks)
>>>{'Prajwal': 95, 'Ram': 68, 'Rohit': 58, 'Subodh': 81, 'Pratham': 70}

dic2array

dic2array tool use for Conervet 1 Dictory into 2 array

Example

dict={'Prajwal': 95, 'Ram': 68, 'Rohit': 58, 'Subodh': 81, 'Pratham': 70}

Now,THis Dictory convert to 2 array
Note:- it return three array
1 =>key value
2 =>item value
3 => key and they value

a,b,c=kit.dic2array(dict)

#its Take varibale a,b and c resptivly

a
>>>(['Prajwal', 'Ram', 'Rohit', 'Subodh', 'Pratham'], 

b
>>>[95, 68, 58, 81, 70], 

c
>>>[('Prajwal', 95), ('Ram', 68), ('Rohit', 58), ('Subodh', 81), ('Pratham', 70)])

License

Requirement

Install python3 on pc:-

🔗 Links

linkedin Gitlab Bitbucket