This commit is contained in:
guanjihuan 2022-09-23 00:45:31 +08:00
parent e3135d8c05
commit 6d5bb85a75
4 changed files with 9 additions and 8 deletions

View File

@ -339,9 +339,9 @@ rgb = guan.hex_to_rgb(hex)
# # Module 13: file processing
guan.write_file_list_in_markdown(directory, filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None)
guan.write_file_list_in_markdown(directory='./', filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None)
repeated_file = guan.find_repeated_file_with_same_filename(directory, num=1000)
repeated_file = guan.find_repeated_file_with_same_filename(directory='./', missed_directory='./missed_directory', num=1000)
guan.creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None)

View File

@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = guan
version = 0.0.138
version = 0.0.139
author = guanjihuan
author_email = guanjihuan@163.com
description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: guan
Version: 0.0.138
Version: 0.0.139
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan

View File

@ -2,7 +2,7 @@
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
# The current version is guan-0.0.138, updated on September 15, 2022.
# The current version is guan-0.0.139, updated on September 23, 2022.
# Installation: pip install --upgrade guan
@ -2563,7 +2563,7 @@ def hex_to_rgb(hex):
# # Module 13: file processing
def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None):
def write_file_list_in_markdown(directory='./', filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None):
import os
f = open(filename+'.md', 'w', encoding="utf-8")
filenames1 = os.listdir(directory)
@ -2665,12 +2665,13 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg
f.write('###### '+str(filename6)+'\n\n')
f.close()
def find_repeated_file_with_same_filename(directory, num=1000):
def find_repeated_file_with_same_filename(directory='./', missed_directory='./missed_directory', num=1000):
import os
from collections import Counter
file_list = []
for root, dirs, files in os.walk(directory):
for i0 in range(len(files)):
if missed_directory not in root:
file_list.append(files[i0])
count_file = Counter(file_list).most_common(num)
repeated_file = []