Skip to content
/ ezpkl Public

EZPKL: lovely pickling🥒 for context manager hater👊

License

Notifications You must be signed in to change notification settings

yesinkim/ezpkl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EZPKL: lovely pickling🥒 for context manager hater👊

PyPI version Python Downloads

EZPKL character I hate with open(file_path) as file... and I don't want to google how to save pickle in python anymore. then, i made it.

Installation

Use the package manager pip to install ezpkl.

pip install ezpkl

Usage

Save Object to pkl

from ezpkl import save_pkl

a = [1, 2, 3, 4, 5]

# 'a.pkl' will be saved in the current directory.
save_pkl(var=a)

# 'a_list_temp.pkl' will be saved in the current directory.
save_pkl(var=a, file_name='a_list_temp')

Load Object

from ezpkl import load_pkl

a = load_pkl('a.pkl')

Save Object to txt

from ezpkl import save_txt

a = [1, 2, 3, 4, 5]

# 'a.txt' will be saved in the current directory.
save_txt(data=a)

# 'a_list_temp.txt' will be saved in the current directory.
save_txt(data=a, file_name='a_list_temp')

Load Object

from ezpkl import load_txt

a = load_txt('a.txt')

Save List Object to txt with separator

from ezpkl import save_txt

a = ["apple", "banana", "cherry"]

# 'a.txt' will be saved in the current directory with newline separator (default).
save_txt(data=a)
# a.txt file content:
# apple
# banana
# cherry

# 'a_list_temp.txt' will be saved in the current directory with space separator.
save_txt(data=a, file_name='a_list_temp', separator=' ')
# a_list_temp.txt file content:
# apple banana cherry

# 'a_list_temp.txt' will be saved in the current directory without separator.
save_txt(data=a, file_name='a_list_temp', separator=None)
# a_list_temp.txt file content:
# applebananacherry

License

MIT

About

EZPKL: lovely pickling🥒 for context manager hater👊

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages