Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Compare folder A and subfolder B and display files that are in folder A but not in su
Post: Compare folder A and subfolder B and display files...

Create a code that compares c:\Folder-Oana\extracted\ and c:\Folder-Oana\extracted\translated\ and shows me the files that are in the first folder, but not in the second. So, compare folder A and subf...
Melcu54 General Coding Help 3 466 Jan-05-2024, 11:59 AM
    Thread: Why can't it extract the data from .txt well?
Post: RE: Why can't it extract the data from .txt well?

This seems to be good import tkinter as tk from unidecode import unidecode import re # Citim cuvintele din dictionar.txt with open('dictionar.txt', 'r', encoding='utf-8') as f: dictionar = f.rea...
Melcu54 General Coding Help 3 645 Aug-20-2023, 12:00 PM
    Thread: Why can't it extract the data from .txt well?
Post: Why can't it extract the data from .txt well?

Version 1. Very good. The dictionaries are compared, and the diacritics from the first dictionary are included in the output. import tkinter as tk import re from tkinter import messagebox, simpledial...
Melcu54 General Coding Help 3 645 Aug-20-2023, 09:12 AM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

FINAL ver 2.0 import tkinter as tk import re from tkinter import messagebox, simpledialog from unidecode import unidecode # Importați unidecode punctuation = re.compile("[:;,\.\"'”“\?!]") def get_...
Melcu54 General Coding Help 13 1,383 Aug-19-2023, 08:14 AM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

Final Version (I add 3 new buttons: Verificare, Modificare and SKIP) Verificare (check each word if it exists in dictionar.txt) Modificare (edit the word and add it to dictionar.txt, and without diac...
Melcu54 General Coding Help 13 1,383 Aug-18-2023, 09:03 PM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

Version 5 (Leep UpperCase, remove default text, retrieve data from dictionar.txt and dictionar-2.txt) import tkinter as tk import re punctuation = re.compile("[:;,\.\"'”“\?!]") def get_words(text, ...
Melcu54 General Coding Help 13 1,383 Aug-18-2023, 07:58 PM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

thanks, deanhystad. You are really great ! I will save here another version, just a little bit different. import tkinter as tk import re def adauga_diacritice(): text = text_input.get("1.0", t...
Melcu54 General Coding Help 13 1,383 Aug-18-2023, 07:50 PM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

yes, the code should compare words from the FORM with words that do not have diacritics from the dictionary-2.txt. If a match is found, the word in the form should be replaced with the corresponding w...
Melcu54 General Coding Help 13 1,383 Aug-18-2023, 04:33 PM
    Thread: Form that puts diacritics on the words in the text
Post: RE: Form that puts diacritics on the words in the ...

did you read carefully what I wrote in the post? This is the sentence from dictionar.txt (With diacritics) Compatibilitatea sufletească nu este direct proporțională cu valoarea intensităţii sentimen...
Melcu54 General Coding Help 13 1,383 Aug-18-2023, 10:21 AM
    Thread: Form that puts diacritics on the words in the text
Post: Form that puts diacritics on the words in the text

I made a code that must add diacritics to the text in the form. Python. I also have two .txt files, dictionary.txt contains a phrase (a set of words) with diacritics. And dictionary-2.txt contains th...
Melcu54 General Coding Help 13 1,383 Aug-17-2023, 04:11 PM
    Thread: Python: Ignore\Exclude files that contain words
Post: Python: Ignore\Exclude files that contain words

maybe someone needs this information def save_to_pdf(directory_path): modified_files = [] file_count = 0 for root, dirs, files in os.walk(directory_path): for file_name in files: ...
Melcu54 Code sharing 0 1,072 Jul-28-2023, 04:27 PM
    Thread: why doesn't it replace all html tags?
Post: RE: why doesn't it replace all html tags?

and the full code here, works fine now: import os import re from googletrans import Translator folder_path = r"c:\Folder3\2" # HTML tags to translate tags_to_translate = [r'<title>(.*?)</t...
Melcu54 General Coding Help 3 692 Jul-05-2023, 04:47 AM
    Thread: why doesn't it replace all html tags?
Post: RE: why doesn't it replace all html tags?

I find the solution. Thanks, deanhystad ! import os import re from googletrans import Translator folder_path = r"c:\Folder3\2" # HTML tags to translate tags_to_translate = [r'<title>(.*?)<...
Melcu54 General Coding Help 3 692 Jul-05-2023, 04:42 AM
    Thread: why doesn't it replace all html tags?
Post: why doesn't it replace all html tags?

I have these lines in a html file. each of them must be translated into Russian, if in contain more than 3 words found in the list. The problem is that only the last tag, <p class="text_obisnuit"&g...
Melcu54 General Coding Help 3 692 Jul-04-2023, 09:07 AM
    Thread: Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att
Post: RE: Python: Regex is not good for re.search (Attri...

SOLUTION 1: FIND: b_content = re.search('^\s*<a href="(.*?)" title="View', new_file_content).group(1)REPLACE: old_file_content = re.sub(', in <a href="(.*?)" title="Vezi', f', in <a href="...
Melcu54 General Coding Help 9 1,385 Jun-28-2023, 11:13 AM
    Thread: Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att
Post: RE: Python: Regex is not good for re.search (Attri...

thank you veru much
Melcu54 General Coding Help 9 1,385 Jun-28-2023, 10:55 AM
    Thread: Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att
Post: RE: Python: Regex is not good for re.search (Attri...

import re # Citește conținutul fișierului new-file.html with open('c:/Folder7/new-file.html', 'r') as file: first_code = file.read() # Citește conținutul fișierului old-file.html with open('c:/F...
Melcu54 General Coding Help 9 1,385 Jun-28-2023, 08:25 AM
    Thread: Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att
Post: RE: Python: Regex is not good for re.search (Attri...

(Jun-28-2023, 07:42 AM)Gribouillis Wrote: (Jun-28-2023, 07:32 AM)bowlofred Wrote: Your regex is anchored at the front of the string.The regex multiline mode (?m) could do the trick. hello. Can you...
Melcu54 General Coding Help 9 1,385 Jun-28-2023, 07:50 AM
    Thread: Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att
Post: Python: Regex is not good for re.search (Attribute...

In my html file I have this line: <div class="color-black mt-lg-0" id="hidden">, in</div> <a href="https://neculaifantanaru.com/en/leadership-pro.html" title="View all articles fr...
Melcu54 General Coding Help 9 1,385 Jun-28-2023, 06:46 AM
    Thread: Python: AttributeError: 'PageObject' object has no attribute 'extract_images'
Post: RE: Python: AttributeError: 'PageObject' object ha...

import os import pytesseract from PIL import Image from pdf2image import convert_from_path from PyPDF2 import PdfFileReader # Path to the folder containing PDF files input_folder = "d:/doc/doc" # Pa...
Melcu54 General Coding Help 2 3,665 Jun-18-2023, 07:47 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020