From 741f8ae5c11fbd0043705fd4996e023027e70267 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Mon, 19 Aug 2024 01:59:23 +0800 Subject: [PATCH] 0.1.119 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/file_reading_and_writing.py | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 1769f7b..891c860 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.118 +version = 0.1.119 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 afa6fd4..07773fd 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.118 +Version: 0.1.119 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/file_reading_and_writing.py b/PyPI/src/guan/file_reading_and_writing.py index 3ea2dce..13d7b9d 100644 --- a/PyPI/src/guan/file_reading_and_writing.py +++ b/PyPI/src/guan/file_reading_and_writing.py @@ -56,10 +56,15 @@ def open_file(filename='a', file_format='.txt', mode='add'): f = open(filename+file_format, 'w', encoding='UTF-8') return f -# 打印到TXT文件 -def print_to_file(content, filename='print_result', file_format='.txt'): +def print_to_file(*args, filename='print_result', file_format='.txt', print_on=True): + if print_on==True: + for arg in args: + print(arg, end=' ') + print() f = open(filename+file_format, 'a', encoding='UTF-8') - f.write(content+'\n') + for arg in args: + f.write(str(arg)+' ') + f.write('\n') f.close() # 读取文本文件内容。如果文件不存在,返回空字符串