0.0.185
This commit is contained in:
parent
dc01fe79ce
commit
652a9d9ce7
@ -1,4 +1,4 @@
|
|||||||
# API Reference shows all functions in Guan package. The current version is guan-0.0.184, updated on December 03, 2023.
|
# API Reference shows all functions in Guan package. The current version is guan-0.0.185, updated on December 05, 2023.
|
||||||
|
|
||||||
import guan
|
import guan
|
||||||
|
|
||||||
@ -821,6 +821,9 @@ rand_num = guan.generate_random_int_number_for_a_specific_seed(seed=0, x_min=0,
|
|||||||
# 统计运行的日期和时间,写进文件
|
# 统计运行的日期和时间,写进文件
|
||||||
guan.statistics_with_day_and_time(content='', filename='a', file_format='.txt')
|
guan.statistics_with_day_and_time(content='', filename='a', file_format='.txt')
|
||||||
|
|
||||||
|
# 统计Python文件中import的数量并排序
|
||||||
|
import_statement_counter = guan.count_number_of_import_statements(filename, file_format='.py', num=1000)
|
||||||
|
|
||||||
# 将RGB转成HEX
|
# 将RGB转成HEX
|
||||||
hex = guan.rgb_to_hex(rgb, pound=1)
|
hex = guan.rgb_to_hex(rgb, pound=1)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
# replace with your username:
|
# replace with your username:
|
||||||
name = guan
|
name = guan
|
||||||
version = 0.0.184
|
version = 0.0.185
|
||||||
author = guanjihuan
|
author = guanjihuan
|
||||||
author_email = guanjihuan@163.com
|
author_email = guanjihuan@163.com
|
||||||
description = An open source python package
|
description = An open source python package
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: guan
|
Name: guan
|
||||||
Version: 0.0.184
|
Version: 0.0.185
|
||||||
Summary: An open source python package
|
Summary: An open source python package
|
||||||
Home-page: https://py.guanjihuan.com
|
Home-page: https://py.guanjihuan.com
|
||||||
Author: guanjihuan
|
Author: guanjihuan
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about (Ji-Huan Guan, 关济寰). The primary location of this package is on website https://py.guanjihuan.com. GitHub link: https://github.com/guanjihuan/py.guanjihuan.com.
|
# Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about (Ji-Huan Guan, 关济寰). The primary location of this package is on website https://py.guanjihuan.com. GitHub link: https://github.com/guanjihuan/py.guanjihuan.com.
|
||||||
|
|
||||||
# The current version is guan-0.0.184, updated on December 03, 2023.
|
# The current version is guan-0.0.185, updated on December 05, 2023.
|
||||||
|
|
||||||
# Installation: pip install --upgrade guan
|
# Installation: pip install --upgrade guan
|
||||||
|
|
||||||
@ -3587,6 +3587,19 @@ def statistics_with_day_and_time(content='', filename='a', file_format='.txt'):
|
|||||||
else:
|
else:
|
||||||
f2.write(datetime_today+' '+datetime_time+' '+content+'\n')
|
f2.write(datetime_today+' '+datetime_time+' '+content+'\n')
|
||||||
|
|
||||||
|
# 统计Python文件中import的数量并排序
|
||||||
|
def count_number_of_import_statements(filename, file_format='.py', num=1000):
|
||||||
|
with open(filename+file_format, 'r') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
import_array = []
|
||||||
|
for line in lines:
|
||||||
|
if 'import ' in line:
|
||||||
|
line = line.strip()
|
||||||
|
import_array.append(line)
|
||||||
|
from collections import Counter
|
||||||
|
import_statement_counter = Counter(import_array).most_common(num)
|
||||||
|
return import_statement_counter
|
||||||
|
|
||||||
# 将RGB转成HEX
|
# 将RGB转成HEX
|
||||||
def rgb_to_hex(rgb, pound=1):
|
def rgb_to_hex(rgb, pound=1):
|
||||||
if pound==0:
|
if pound==0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user