parsing

Which regular expression do I have to implement to extract text between two lines containing a string and an arbitrary number of digits?

Which regular expression do I have to implement to extract text between two lines containing a string and an arbitrary number of digits? Question: That’s the code I have: text = ‘LIBRO 1ndsfsdfnasdasnfgfghfnLIBRO 21nhghjnghjhjknghjhknLIBRO 333′ result = re.findall(r'(?<=LIBRO d+n)(.*?)(?=nLIBRO)’, text, re.DOTALL) print(result) and this is the error I get: re.error: look-behind requires fixed-width pattern the …

Total answers: 1

BeautifulSoup: Duplicated Class parsing how to overcome

BeautifulSoup: Duplicated Class parsing how to overcome Question: I am finding some difficulties in parsing the HTML with "class" using BeautifulSoup. The idea is to get the price of an item on a website which has the following HTML exposure: HTML structure Therefore, I need the £920 as a text. I have tried the following: …

Total answers: 2

How to parse multiple statements in sly?

How to parse multiple statements in sly? Question: I am trying to parse some code using sly. I would like to separate the statements with a semicolon. I have defined a token called SEMI which represents a semicolon: class MyLexer(Lexer): tokens = { …, SEMI } SEMI = r";" … If I use SEMI inside …

Total answers: 2

Python : Download/Scrape HTML code inside "shadow-root" nodes of pages

Python : Download/Scrape HTML code inside "shadow-root" nodes of pages Question: I am writing to ask for a hand in downloading an HTML page that contains various shadow-roots When I try to download this page (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm) with python, the result is the base HTML without all the node content in the shadow-root. This is my …

Total answers: 1

Improperly formatted json?

Improperly formatted json? Question: First, I am new to Python and working with JSON. I am trying to extract just one value from an API request response, and I am having a difficult time parsing out the data I need. I have done a lot of searching on how to do this, but most all …

Total answers: 2

How can I fix my DSL grammar to parse a problem statement?

How can I fix my DSL grammar to parse a problem statement? Question: I’ve been tasked with creating a grammar for a legacy DSL that’s been in use for over 20 years. The original parser was written using a mess of regular expressions, so I’ve been told. The syntax is generally of the "if this …

Total answers: 2

Get all substrings between two markers containing a keyword

Get all substrings between two markers containing a keyword Question: If i have a string like b*&^6bolyb{[–9_(marker1JN9&[7&9bkey=-+)*.,mljmarker2,pi*[80[)(Mmp0oiymarker1ojm)*[marker2,;i0m980m.9u090marker1*(7hp0Key0()mu90marker2 how do i extract the part between marker1 and marker2 if it contains key (or ‘Key’ or any other variation in case) ? So i’d like to have the code return: [‘JN9&[7&9bkey=-+)*.,mlj’, ‘*(7hp0Key0()mu90’] Asked By: Raksha || Source …

Total answers: 1

Multithreading in the program does not work for me, what could be the problem?

Multithreading in the program does not work for me, what could be the problem? Question: I’m trying to make my account autoregister on 1 of the servicers using python. I decided to resort to multithreading. I enter the number of threads I need into the console, but they do not start asynchronously. At first, the …

Total answers: 1

trying to click a html button with selenium with python

trying to click a html button with selenium with python Question: Trying to go trough a website using selenium to parse some stuff, but i cant click it on a button to load a pop up java script page using firefox + geckowebdriver (latest) view_larger_image_button = driver.find_element_by_xpath(‘//span[text()="View larger image"]’) driver.click(view_larger_image_button) Here is the button : …

Total answers: 1

How to handle json object that was stringified in Python

How to handle json object that was stringified in Python Question: I have a question about JSON.stringify() and how to parse it. I have a frontend code and a backend in python (Django). My fetch function looks like this in frontend. const response = await fetch(‘some-url’, { method: "POST", headers: { "Content-Type": "application/json", }, body: …

Total answers: 1