diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index f6163d2..83064b7 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.69 +version = 0.1.70 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index d5d5113..b5986bc 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.69 +Version: 0.1.70 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/basic_functions.py b/PyPI/src/guan/basic_functions.py index 96b89d7..aff7813 100644 --- a/PyPI/src/guan/basic_functions.py +++ b/PyPI/src/guan/basic_functions.py @@ -6,7 +6,7 @@ import guan def test(): import guan current_version = guan.get_current_version('guan') - print(f'\nCongratulations on successfully installing Guan package! The installed version is guan-{current_version}.') + print(f'Congratulations on successfully installing Guan package! The installed version is guan-{current_version}.') # 泡利矩阵 @guan.statistics_decorator diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index f7dc707..16f8440 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -402,6 +402,34 @@ def color_matplotlib(): color_array = ['tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'] return color_array +# 如果不存在文件夹,则新建文件夹 +@guan.statistics_decorator +def make_directory(directory='./test'): + import os + if not os.path.exists(directory): + os.makedirs(directory) + +# 如果不存在文件,则新建空文件 +@guan.statistics_decorator +def make_file(file_path='./a.txt'): + import os + if not os.path.exists(file_path): + with open(file_path, 'w') as f: + pass + +# 读取文本文件内容,如果不存在,则新建空文件 +@guan.statistics_decorator +def read_text_file(file_path='./a.txt'): + import os + if not os.path.exists(file_path): + with open(file_path, 'w') as f: + pass + return '' + else: + with open(file_path, 'r') as f: + content = f.read() + return content + # 将变量存到文件 @guan.statistics_decorator def dump_data(data, filename, file_format='.txt'): diff --git a/PyPI/src/guan/others.py b/PyPI/src/guan/others.py index 363eeff..6fec614 100644 --- a/PyPI/src/guan/others.py +++ b/PyPI/src/guan/others.py @@ -1,13 +1,6 @@ # Module: others import guan -# 如果不存在文件夹,则新建文件夹 -@guan.statistics_decorator -def make_directory(directory='./test'): - import os - if not os.path.exists(directory): - os.makedirs(directory) - # 获取当前日期字符串 @guan.statistics_decorator def get_date(bar=True):