element

How to filter elements in a list that occur only once

How to filter elements in a list that occur only once Question: I need to filter and discard elements in a list that occur only once. I have the following list of integers as input. I need to make a new list that contains only elements that do not have singular appearances. item_list = [502, …

Total answers: 2

Scraping content from what appear to be identical HTML elements

Scraping content from what appear to be identical HTML elements Question: Python: Python 3.11.2 Python Editor: PyCharm 2022.3.3 (Community Edition) – Build PC-223.8836.43 OS: Windows 11 Pro, 22H2, 22621.1413 Browser: Chrome 111.0.5563.65 (Official Build) (64-bit) I’m looking at the following URL — https://dockets.justia.com/docket/puerto-rico/prdce/3:2023cv01127/175963 — from which I’m attempting to scrape data from class elements that …

Total answers: 1

How to discard innerText between certain elements using Selenium Python?

How to discard innerText between certain elements using Selenium Python? Question: I am writing a webpage scraper to collate sentences in Japanese. My source utilises so-called furigana, which appears as characters above kanji to indicate the Kanji’s pronunciation. I do not want this furigana to appear in my scraped sentences. The website’s source html looks …

Total answers: 1

How to add an XML element to an existing text in a XML file with python

How to add an XML element to an existing text in a XML file with python Question: I have a problem with some values not being declared as XML elements in my XML files. But for further processing, I need them to be an element. Example: <A> <B id="254"> <C>Lore</C> <D>9</D> 12.34 </B> <B id="255"> …

Total answers: 1

Delete all tuples from a list, if the first two elements of another tuple matches

Delete all tuples from a list, if the first two elements of another tuple matches Question: i have two tuple lists, and i want to delete all tuples from list1, if the first two elements of a tuple from list2 matches with the first two elements of a tuple from list1. list1 = [(‘google’, ‘data’, …

Total answers: 2

Trouble modifying a value in a list

Trouble modifying a value in a list Question: Using Python 3.11.1 in JupyterLab Version 3.5.2 I,m getting this error message and I’m not sure how. list is a list with 6 items within it. As you can see Dad is the first item. I am trying to reassign this value to Mike. The error message …

Total answers: 2

Do Elements not start from 0?

Do Elements not start from 0? Question: I’m a noob, learning via Datacamp (which is really annoying and nitpicky… I could’ve sworn elements started from 0, counting the first element in the list as 0???? This is the problem. "Create downstairs again, as the first 6 elements of areas. This time, simplify the slicing by …

Total answers: 2

Python: how to dynamically add a number to the end of the name of a list

Python: how to dynamically add a number to the end of the name of a list Question: In python I am appending elements to a list. The element name I am getting from an input file, so the element_name is an unknown. I would like to create a new list by adding a number to …

Total answers: 3

How to print each element of a list until a certain length Python

How to print each element of a list until a certain length Python Question: How to print each element of my list to a defined length (5), so for example: myList = ["abcdefgh", "ijklmnop"] The output I’m looking for is: abcde ijklm I’ve tried this (printing dates from an excel sheet): i = 2 x …

Total answers: 1