jkzhj 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jkzhj-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: jkzhj
3
+ Version: 0.1.0
4
+ Summary: My simple function package
5
+ Author-email: zhjie <1359713353@qq.com>
6
+ Requires-Python: >=3.7
@@ -0,0 +1,3 @@
1
+ from .suf import suf
2
+ from .jdir import jdir
3
+
@@ -0,0 +1,38 @@
1
+ def jdir(*p):
2
+ function ="""
3
+ 返回当前文件夹内的 文件和文件夹列表 路径和时间
4
+
5
+ Returns:
6
+ dict: 包含 'files' 和 'dirs' ' dt cwd' 3个键的字典
7
+
8
+ # 使用示例
9
+ items0 = jdir() # 函数说明
10
+ items = jdir(1) # 运行函数
11
+ """
12
+ if len(p) == 0 or len(p)>1:
13
+ print('警告:输入的有效参数个数为: 1 \n',function)
14
+ return function
15
+
16
+ import os
17
+
18
+ # from pathlib import Path
19
+ from datetime import datetime
20
+
21
+ now = datetime.now()
22
+ dt = now.strftime("%Y-%m-%d %H:%M:%S %A")
23
+ cwd = os.getcwd()
24
+ # current_dir = Path('.')
25
+ # files = [item.name for item in current_dir.iterdir() if item.is_file()]
26
+ # dirs = [item.name for item in current_dir.iterdir() if item.is_dir()]
27
+ current_dir = os.listdir('.')
28
+ dirs = [name for name in current_dir if os.path.isdir(name)]
29
+ files = [name for name in current_dir if os.path.isfile(name)]
30
+
31
+
32
+ return {
33
+ 'files': files,
34
+ 'dirs': dirs,
35
+ # 'files dirs': files + dirs,
36
+ ' dt cwd': dt + ' '+ ' '+ ' ' + cwd
37
+ }
38
+
@@ -0,0 +1,119 @@
1
+ # **************** j59 jsuf(*xinput): ************************************
2
+ def jsuf(*p):
3
+ import os
4
+ import pandas as pd
5
+ # info为提示信息:必须是 5 部分,分别是 编写 功能 输入参数 输出参数 用法
6
+ info = """
7
+ 编写: 2024 3 5 环境 Anaconda3 2023.09(python3.11.5)
8
+
9
+ 功能 :显示 1--3 个指定后缀(suffix)的 文件列表 仅限当前位置。若包括子文件夹则用 jren
10
+
11
+ 输入参数:个数是 1-3 个,否则,提示函数用法。类型是 字符 str(文件后缀)。
12
+ p0: 文件后缀,格式如:'py'
13
+ p1: 文件后缀,格式如:'py'
14
+ p2: 文件后缀,格式如:'py'
15
+
16
+ 输出变量:
17
+ 输入参数个数为0或大于3时,输出字符变量,返回函数说明
18
+ 输入参数1个时,返回1个列表
19
+ 输入参数2个时,返回1个元组,内有2个列表
20
+ 输入参数3个时,返回1个元组,内有3个列表
21
+
22
+ 用法:
23
+ ======================= 用法说明 开始 =====================
24
+ 0/4 输入参数个数 0 and >最大值 ============================
25
+ 0/4 不是 1 2 3 个输入参数时
26
+ j59 = jsuf( )
27
+ r4 = jsuf(1,2,3,4)
28
+
29
+ 返回结果: 提示 功能与用法
30
+
31
+ 1/4 是 1 个输入参数时 =====================================
32
+ r1 = jsuf('py')
33
+
34
+ 返回后缀 py 的文件列表
35
+
36
+ 2/4 是 2 个输入参数时 =====================================
37
+ r2 = jsuf('py','doc')
38
+
39
+ 返回后缀 py doc* 的文件列表
40
+
41
+ 3/4 是 3 个输入参数时 =====================================
42
+ r3 = jsuf('py','doc','xls')
43
+
44
+ 返回后缀 py doc* xls* 的文件列表
45
+ ======================= 用法说明 结束 ======================
46
+ """
47
+ waring = """警告: 输入 1--3 个 后缀 如 r3 = jsuf('py','doc','xls')
48
+ """ + info
49
+ # 输入参数个数 0 and >最大值 =================================
50
+ # 0/4 不是 1 2 3个输入参数时 ===============================
51
+ # ************************************************************
52
+ from pathlib import Path
53
+ # 获取当前目录
54
+ current_dir = Path('.')
55
+ # 列出所有文件夹
56
+ folders = [item.name for item in current_dir.iterdir() if item.is_dir()]
57
+ foldersdf = pd.DataFrame(folders)
58
+ print("====== 当前目录下的文件夹:")
59
+ print(foldersdf.to_string(header=False))
60
+ if not (1 <= len(p) <= 3):
61
+
62
+ print(waring)
63
+ return waring,folders
64
+
65
+ # ************************************************************
66
+
67
+
68
+ # 获取当前文件夹内所有文件file name all
69
+ fna = os.listdir()
70
+ # 1/4 是 1 个输入参数时 ====================================
71
+ if len(p) >= 1:
72
+ if p[0] == "xls":
73
+ fn0 = [fn for fn in fna if fn.endswith((".xls", ".xlsx"))]
74
+ elif p[0] == "doc":
75
+ fn0 = [fn for fn in fna if fn.endswith(('.doc',"docx"))]
76
+ else:
77
+ fn0 = [fn for fn in fna if fn.endswith(p[0])]
78
+ print("'''","\n ==========================================")
79
+ dfn0 = pd.DataFrame(fn0)
80
+ print(dfn0.to_string(header=False))
81
+ print(" ==========================================","\n'''")
82
+ # return dfn0
83
+ # 2/4 是 2 个输入参数时 ====================================
84
+ if len(p) >= 2:
85
+ if p[1] == "xls":
86
+ fn1 = [fn for fn in fna if fn.endswith((".xls", ".xlsx"))]
87
+ elif p[1] == "doc":
88
+ fn1 = [fn for fn in fna if fn.endswith(('.doc',"docx"))]
89
+ else:
90
+ fn1 = [fn for fn in fna if fn.endswith(p[1])]
91
+ print("'''","\n ==========================================")
92
+ dfn1 = pd.DataFrame(fn1)
93
+ print(dfn1.to_string(header=False))
94
+ print(" ==========================================","\n'''")
95
+ # return dfn0,dfn1
96
+ # 3/4 是 3 个输入参数时 ====================================
97
+ if len(p) == 3:
98
+ if p[2] == "xls":
99
+ fn2 = [fn for fn in fna if fn.endswith((".xls", ".xlsx"))]
100
+ elif p[2] == "doc":
101
+ fn2 = [fn for fn in fna if fn.endswith(('.doc',"docx"))]
102
+ else:
103
+ fn2 = [fn for fn in fna if fn.endswith(p[2] )]
104
+ print("'''","\n ==========================================")
105
+ dfn2 = pd.DataFrame(fn2)
106
+ print(dfn2.to_string(header=False))
107
+ print(" ==========================================","\n'''")
108
+ if len(p) == 1:
109
+ return fn0,folders
110
+ if len(p) == 2:
111
+ return fn0,fn1,folders
112
+ if len(p) == 3:
113
+ return fn0,fn1,fn2,folders
114
+ print("== jsuf 程序运行完毕 ==")
115
+ # End j59 jsuf(*p) =======================================
116
+ '''
117
+ # **************** j59 jsuf(*xinput): ************************************
118
+ # **************** j60 jpdf2jpg(*xinput): 开始 *****************************
119
+ '''
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: jkzhj
3
+ Version: 0.1.0
4
+ Summary: My simple function package
5
+ Author-email: zhjie <1359713353@qq.com>
6
+ Requires-Python: >=3.7
@@ -0,0 +1,8 @@
1
+ pyproject.toml
2
+ jkzhj/__init__.py
3
+ jkzhj/jdir.py
4
+ jkzhj/jsuf.py
5
+ jkzhj.egg-info/PKG-INFO
6
+ jkzhj.egg-info/SOURCES.txt
7
+ jkzhj.egg-info/dependency_links.txt
8
+ jkzhj.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ jkzhj
@@ -0,0 +1,10 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "jkzhj"
7
+ version = "0.1.0"
8
+ authors = [{ name = "zhjie", email = "1359713353@qq.com" }]
9
+ description = "My simple function package"
10
+ requires-python = ">=3.7"
jkzhj-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+