בקשה | מחפש אקסל עם כל סימני וסעיפי שולחן ערוך
-
@הריי-צ באיזה רמה?
באיזה סדר זה יחולק?@יום-חדש-מתחיל אולי לך יש מהפרויקט של אוצריא?
@י.-פל. זכור לי שגם אתה היית שם בעסק, לא? -
@הריי-צ
שולחן ערוך, אבן העזר.csv
שולחן ערוך, אורח חיים.csv
שולחן ערוך, חושן משפט.csv
שולחן ערוך, יורה דעה.csvנראה לי שיש בעיה ביורה דעה בגלל סדר הגט וכו'
import os import csv base_folder = r"C:\אוצריא\אוצריא\הלכה\שולחן ערוך" for i in os.listdir(base_folder): if i.endswith(".txt"): file_name = os.path.splitext(i)[0] header = 2 if file_name == "שולחן ערוך, אבן העזר": header = 3 with open(f"{file_name}.csv", 'w', encoding='windows-1255', newline="") as f: writer = csv.writer(f) writer.writerow(["סימן", "מספר הסעיפים"]) with open(os.path.join(base_folder, i), 'r', encoding='utf-8') as file: content = file.readlines() siman = "" seif = 0 for line in content[2:]: if line.strip().startswith(f"<h{header - 1}>"): continue if line.strip().startswith(f"<h{header}>"): if siman: writer.writerow([siman, seif]) siman = line.strip().replace(f"<h{header}>", "").replace(f"</h{header}>", "") seif = 0 else: seif += 1 if siman: writer.writerow([siman, seif])
-
אולי זה יותר טוב
שולחן ערוך, אבן העזר.csv
שולחן ערוך, אורח חיים.csv
שולחן ערוך, חושן משפט.csv
שולחן ערוך, יורה דעה.csvimport os import csv base_folder = r"C:\אוצריא\אוצריא\הלכה\שולחן ערוך" target_folder = r"C:\Users\User\Desktop\שוע" os.makedirs(target_folder, exist_ok=True) for i in os.listdir(base_folder): if i.endswith(".txt"): file_name = os.path.splitext(i)[0] with open(os.path.join(target_folder, f"{file_name}.csv"), 'w', encoding='windows-1255', newline="") as f: writer = csv.writer(f) writer.writerow(["סימן", "מספר הסעיפים"]) with open(os.path.join(base_folder, i), 'r', encoding='utf-8') as file: content = file.readlines() siman = "" seif = 0 for line in content[2:]: if line.strip().startswith(("<h2>", "<h3>")): if siman: writer.writerow([siman, seif]) siman = line.strip().replace("<h2>", "").replace(f"</h2>", "").replace("<h3>", "").replace(f"</h3>", "") seif = 0 else: seif += 1 if siman: writer.writerow([siman, seif])
-
אולי זה יותר טוב
שולחן ערוך, אבן העזר.csv
שולחן ערוך, אורח חיים.csv
שולחן ערוך, חושן משפט.csv
שולחן ערוך, יורה דעה.csvimport os import csv base_folder = r"C:\אוצריא\אוצריא\הלכה\שולחן ערוך" target_folder = r"C:\Users\User\Desktop\שוע" os.makedirs(target_folder, exist_ok=True) for i in os.listdir(base_folder): if i.endswith(".txt"): file_name = os.path.splitext(i)[0] with open(os.path.join(target_folder, f"{file_name}.csv"), 'w', encoding='windows-1255', newline="") as f: writer = csv.writer(f) writer.writerow(["סימן", "מספר הסעיפים"]) with open(os.path.join(base_folder, i), 'r', encoding='utf-8') as file: content = file.readlines() siman = "" seif = 0 for line in content[2:]: if line.strip().startswith(("<h2>", "<h3>")): if siman: writer.writerow([siman, seif]) siman = line.strip().replace("<h2>", "").replace(f"</h2>", "").replace("<h3>", "").replace(f"</h3>", "") seif = 0 else: seif += 1 if siman: writer.writerow([siman, seif])
@האדם-החושב כתב בבקשה | מחפש אקסל עם כל סימני וסעיפי שולחן ערוך:
אולי זה יותר טוב
שולחן ערוך, אבן העזר.csv
שולחן ערוך, אורח חיים.csv
שולחן ערוך, חושן משפט.csv
שולחן ערוך, יורה דעה.csvimport os import csv base_folder = r"C:\אוצריא\אוצריא\הלכה\שולחן ערוך" target_folder = r"C:\Users\User\Desktop\שוע" os.makedirs(target_folder, exist_ok=True) for i in os.listdir(base_folder): if i.endswith(".txt"): file_name = os.path.splitext(i)[0] with open(os.path.join(target_folder, f"{file_name}.csv"), 'w', encoding='windows-1255', newline="") as f: writer = csv.writer(f) writer.writerow(["סימן", "מספר הסעיפים"]) with open(os.path.join(base_folder, i), 'r', encoding='utf-8') as file: content = file.readlines() siman = "" seif = 0 for line in content[2:]: if line.strip().startswith(("<h2>", "<h3>")): if siman: writer.writerow([siman, seif]) siman = line.strip().replace("<h2>", "").replace(f"</h2>", "").replace("<h3>", "").replace(f"</h3>", "") seif = 0 else: seif += 1 if siman: writer.writerow([siman, seif])
למה זה כותב לי שורה אחת בסינית
-
@האדם-החושב כתב בבקשה | מחפש אקסל עם כל סימני וסעיפי שולחן ערוך:
אולי זה יותר טוב
שולחן ערוך, אבן העזר.csv
שולחן ערוך, אורח חיים.csv
שולחן ערוך, חושן משפט.csv
שולחן ערוך, יורה דעה.csvimport os import csv base_folder = r"C:\אוצריא\אוצריא\הלכה\שולחן ערוך" target_folder = r"C:\Users\User\Desktop\שוע" os.makedirs(target_folder, exist_ok=True) for i in os.listdir(base_folder): if i.endswith(".txt"): file_name = os.path.splitext(i)[0] with open(os.path.join(target_folder, f"{file_name}.csv"), 'w', encoding='windows-1255', newline="") as f: writer = csv.writer(f) writer.writerow(["סימן", "מספר הסעיפים"]) with open(os.path.join(base_folder, i), 'r', encoding='utf-8') as file: content = file.readlines() siman = "" seif = 0 for line in content[2:]: if line.strip().startswith(("<h2>", "<h3>")): if siman: writer.writerow([siman, seif]) siman = line.strip().replace("<h2>", "").replace(f"</h2>", "").replace("<h3>", "").replace(f"</h3>", "") seif = 0 else: seif += 1 if siman: writer.writerow([siman, seif])
למה זה כותב לי שורה אחת בסינית
@עניו-כמשה באקסל?, איזה אקסל?
-
@עניו-כמשה באקסל?, איזה אקסל?
@האדם-החושב כתב בבקשה | מחפש אקסל עם כל סימני וסעיפי שולחן ערוך:
@עניו-כמשה באקסל?, איזה אקסל?
האמת שבדקתי בגוגל שיטס לא באקסל