Skip to main content

All Questions

0 votes
1 answer
556 views

Checking For Next Line

I am attempting to loop over a series of text files I have and I want to do so by checking the value of the next line. The input from the text file looks like: Person1 (COUNT)|key 1|************ ...
Mixus's user avatar
  • 1
0 votes
1 answer
65 views

python nesting loops

I am trying perform a nested loop to combine data into a line by using matched MAC Addresses in both files. I am able to pull the loop fine without the regex, however, when using the search regex ...
PaulP's user avatar
  • 1
0 votes
1 answer
1k views

python loop through list through regex

I am trying to iterate a list with for loop and build a second list through regex capture group. I looked through documentation related to the re module but for some reason, the regex always return ...
penguin02007's user avatar
1 vote
1 answer
167 views

Looping through pandas data frame while changing row values using regex

-EDIT- As Daniel Kasatchkow (below) suggested, I have attempted the following: df._links.str.findall('qwer://abc\\\.x-data\\\.orc/v1/i/\d+/users') But I get the following output: 0 NaN 1 NaN ...
Enigmatic's user avatar
  • 4,187
1 vote
2 answers
1k views

Loop back to beginning of code if input doesn't match REGEX | Python 2.7 [duplicate]

I'm trying to make my code loop back to the beginning until the user inputs something that matches the REGEX pattern. For example: userInput = raw_input('Enter text :') if re.match("REGEX", ...
Enigmatic's user avatar
  • 4,187
0 votes
1 answer
69 views

Searching two csv files for matching variables using Python

I am writing a code to create a total list of players from a set of descriptions. Have one CSV file with descriptions of each NFL play in the past year, such as "44-J.STARKS RIGHT GUARD TO GB 41 FOR 2 ...
Mason Gardner's user avatar
0 votes
2 answers
84 views

Python 2.7 - Iterating Over Elements in 2 Different Lists, Why Each One Print Different Format

In my newbie experimenting and trying to write lots of little scripts and learn; I bumped into this puzzlement: import re nouns = ['bacon', 'cheese', 'eggs', 'milk'] article = [] def list_in_list(...
Darren Haynes's user avatar
0 votes
1 answer
3k views

Python - Loop through list within regex

Right, i'm relatively new to Python, which you will likely see in my code, but is there any way to iterate through a list within regex? Basically, i'm looping through each filename within a folder, ...
hansolo's user avatar
  • 269
0 votes
2 answers
41 views

How to apply conditional treatment with line.endswith(x) where x is a regex result?

I am trying to apply conditional treatment for lines in a file (symbolised by list values in a list for demonstration purposes below) and would like to use a regex function in the endswith(x) method ...
user1063287's user avatar
  • 10.9k
0 votes
1 answer
72 views

What is the regex required to find specific urls within content from a list of urls generated by a for loop?

As I write this I realise there are two parts to this question, however I think I am only really stuck on the first part and therefore the second is only provided for context: Part A: I need to ...
user1063287's user avatar
  • 10.9k