Skip to main content

All Questions

Tagged with
-2 votes
2 answers
80 views

Better way to iterate over a list?

I am using fitz to scrape PDFs. I use the following code to generate a list of words located in the pdf. import fitz doc = fitz.open("very_important_document.pdf") for page in doc.pages(0, ...
magladde's user avatar
  • 634
0 votes
3 answers
47 views

Iterating through strings, adding to list and then accessing

My variable x holds the following data and I want to extract only the links (https://...) 1758162 hd video/mp4 2160 3840 23.976 https://player.vimeo.com/external/479728625.hd.mp4?s=...
mnnewbilr's user avatar
-2 votes
2 answers
144 views

Iterating through a list of string in python to return words with the same vowels

Your function word_list will take in a list of words. All words that have all the same vowels as the first word in the list should be returned in a list. The number of vowels does not matter, just ...
tanooki's user avatar
1 vote
1 answer
55 views

How do you remove words with 3 of the same letters in a row, such as abbbe or accce from a list in Python?

I found a similar question for R but not for Python. Apologies if it does exist, but I cannot find it. I have a long list of words out of the dictionary. I'm just trying to get rid of all the words ...
Wayne Filkins's user avatar
0 votes
2 answers
354 views

Remove similar Strings in Python List by Levenshtein Ratio

I am trying to remove similar words in a python List by calculating the Levenshtein ratio between them. If the ratio is >0.9 the word should be removed. So I have to create a loop that iterates ...
schieslu's user avatar
0 votes
1 answer
30 views

how do i compactly (without listing every index value) use a list when formatting a string

values =[" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", &...
Ethan2001's user avatar
0 votes
3 answers
33 views

How to do something else at the end of an iteration

I have a list that contains some strings , I want to add some predefined values before every string in a list but the value at the end of the iteration should be different Here is the list lst = ['...
Hiresh Verma's user avatar
-3 votes
4 answers
907 views

Iterating over a list of integers and joining items based on a condition

I am attempting to iterate over a list of integers and to join them based on a condition using the python standard library. For example, I have a list of integers that looks as such: listOfIntegers = [...
42Dugg's user avatar
  • 5
0 votes
2 answers
248 views

How do I take a value from a list and iterate over a separate string to find the indices where the value is present? [closed]

I have a list as below: a_list=['i'] I also have this string: a_string='i dont know where i belong but i know i am okay here' How would I iterate over the string to find each index where the list ...
Veneratu's user avatar
0 votes
1 answer
127 views

Accessing string elements of a list

Let's say I have a list and I want to access all items of the list which is a string and in the item, I want to access till a specific element how will I do that. The list is given below it is data ...
Abhishek Mishra's user avatar
0 votes
0 answers
169 views

kdb: How to double-loop over a text file and extract the values, per line, per key?

I am working on question 4 of adventofcode. I have a list of strings called "q4" where there are 3 lines (just simple data for now) and each line has keys & values, such as: passport ID ...
JZL's user avatar
  • 53
1 vote
3 answers
74 views

How do i check the 2 item of every string for more than one occurence

[‘AC’, ‘2H’, ‘3S’, ‘4C’] How do I check if the 1st index (eg 2nd element) of every string occurs more than once? For example, in this case, C occurs 2 times so I need to return False This must apply ...
Bryan Ng's user avatar
0 votes
2 answers
4k views

How to iterate over the letters in a string ignoring blank spaces?

I have been searching for this a while now and I can't find an answer that helps me. for i in range(len(string)): list.append(string) return list If e.g the string contains blank spaces it will ...
snovy's user avatar
  • 38
-4 votes
3 answers
68 views

Why is this Boolean false?

Why is Python saying that 'e' is not found in strvowel? I have tried formatting the string as: 'aeiouAEIOU' but that doesn't work either vowel = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] ...
Sydney Ballard's user avatar
-2 votes
2 answers
725 views

Java: For loop on Objects of Strings

I'm new in Java and I have to solve this exercise. I have this code: public class StringList { private String list = ""; public StringList(String... str) { for (...
tersan's user avatar
  • 7

15 30 50 per page