Update get_file_list_and_write_in_markdown.py
This commit is contained in:
		| @@ -9,7 +9,7 @@ def main(): | ||||
|     write_file_list_in_markdown(directory) | ||||
|  | ||||
|  | ||||
| def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_type=[], hide_file_type=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) | ||||
| @@ -17,8 +17,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|     for filename1 in filenames1[::reverse_positive_or_negative]: | ||||
|         filename1_with_path = os.path.join(directory,filename1)  | ||||
|         if os.path.isfile(filename1_with_path):  # 文件 | ||||
|             if os.path.splitext(filename1)[1] not in banned_type: | ||||
|                 if hide_file_type == None: | ||||
|             if os.path.splitext(filename1)[1] not in banned_file_format: | ||||
|                 if hide_file_format == None: | ||||
|                     f.write('+ '+str(filename1)+'\n\n') | ||||
|                 else: | ||||
|                     f.write('+ '+str(os.path.splitext(filename1)[0])+'\n\n') | ||||
| @@ -35,8 +35,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|             for filename2 in filenames2[::reverse_positive_or_negative]: | ||||
|                 filename2_with_path = os.path.join(directory, filename1, filename2)  | ||||
|                 if os.path.isfile(filename2_with_path):  # 文件 | ||||
|                     if os.path.splitext(filename2)[1] not in banned_type: | ||||
|                         if hide_file_type == None: | ||||
|                     if os.path.splitext(filename2)[1] not in banned_file_format: | ||||
|                         if hide_file_format == None: | ||||
|                             f.write('+ '+str(filename2)+'\n\n') | ||||
|                         else: | ||||
|                             f.write('+ '+str(os.path.splitext(filename2)[0])+'\n\n') | ||||
| @@ -54,8 +54,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|                     for filename3 in filenames3[::reverse_positive_or_negative]: | ||||
|                         filename3_with_path = os.path.join(directory, filename1, filename2, filename3)  | ||||
|                         if os.path.isfile(filename3_with_path):    # 文件 | ||||
|                             if os.path.splitext(filename3)[1] not in banned_type: | ||||
|                                 if hide_file_type == None: | ||||
|                             if os.path.splitext(filename3)[1] not in banned_file_format: | ||||
|                                 if hide_file_format == None: | ||||
|                                     f.write('+ '+str(filename3)+'\n\n') | ||||
|                                 else: | ||||
|                                     f.write('+ '+str(os.path.splitext(filename3)[0])+'\n\n') | ||||
| @@ -72,8 +72,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|                             for filename4 in filenames4[::reverse_positive_or_negative]: | ||||
|                                 filename4_with_path = os.path.join(directory, filename1, filename2, filename3, filename4)  | ||||
|                                 if os.path.isfile(filename4_with_path):   # 文件 | ||||
|                                     if os.path.splitext(filename4)[1] not in banned_type: | ||||
|                                         if hide_file_type == None: | ||||
|                                     if os.path.splitext(filename4)[1] not in banned_file_format: | ||||
|                                         if hide_file_format == None: | ||||
|                                             f.write('+ '+str(filename4)+'\n\n') | ||||
|                                         else: | ||||
|                                             f.write('+ '+str(os.path.splitext(filename4)[0])+'\n\n') | ||||
| @@ -86,8 +86,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|                                     for filename5 in filenames5[::reverse_positive_or_negative]: | ||||
|                                         filename5_with_path = os.path.join(directory, filename1, filename2, filename3, filename4, filename5)  | ||||
|                                         if os.path.isfile(filename5_with_path):    # 文件 | ||||
|                                             if os.path.splitext(filename5)[1] not in banned_type: | ||||
|                                                 if hide_file_type == None: | ||||
|                                             if os.path.splitext(filename5)[1] not in banned_file_format: | ||||
|                                                 if hide_file_format == None: | ||||
|                                                     f.write('+ '+str(filename5)+'\n\n') | ||||
|                                                 else: | ||||
|                                                     f.write('+ '+str(os.path.splitext(filename5)[0])+'\n\n') | ||||
| @@ -100,8 +100,8 @@ def write_file_list_in_markdown(directory, filename='a', reverse_positive_or_neg | ||||
|                                             for filename6 in filenames6[::reverse_positive_or_negative]: | ||||
|                                                 filename6_with_path = os.path.join(directory, filename1, filename2, filename3, filename4, filename5, filename6)  | ||||
|                                                 if os.path.isfile(filename6_with_path):   # 文件 | ||||
|                                                     if os.path.splitext(filename6)[1] not in banned_type: | ||||
|                                                         if hide_file_type == None: | ||||
|                                                     if os.path.splitext(filename6)[1] not in banned_file_format: | ||||
|                                                         if hide_file_format == None: | ||||
|                                                             f.write('+ '+str(filename6)+'\n\n') | ||||
|                                                         else: | ||||
|                                                             f.write('+ '+str(os.path.splitext(filename6)[0])+'\n\n') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user