Skip to content
Advertisement

Tag: iteration

Reading next line of big text file

I’m new to python. I have a huge text file (about 15gb), so it is not possible to read in all the lines, I have read here how to fix that problem. Now about my problem. Is it possible to read the next line within a for loop without jumping to the beginning of the loop. This is what I

How to look for specific values in a dictionary and return them properly

So I have a list dictionary of dictionaries (lst) that I’m trying to iterate through, compare values, and return the appropriate values. I have the following code to retrieve 2 arguments given from the command line, compare them through the dictionaries entries, and return the appropriate value: get_attribute_number(cmd1=sys.argv[1], cmd2=sys.argv[2], lst=data_list) However, my program is not returning anything. It is supposed

Python Regex DataFrame match

I have a DataFrame and I would like to perform a sorting if the match between my regex and the name of one of the lines of this DataFrame matches. Is there an option in the “re” library to help me? I try with this piece of code but without success Thank you in advance for your answers Answer I

Iterative summation

I’m trying to write a python code that allows me to iteratively sum up the average values of three elements of a list, starting with the third element and its two predecessors. Let me give you an example: I want to calculate the following: Since I’m quite new to programming I couldn’t find an effective way of putting this into

The iteration loop is not working properly for API

There is an API that only produces one hundred results per page. I am trying to make a while loop so that it goes through all pages and takes results from all pages, but it does not work properly. This script goes through the pages: At startup: He sees five pages. When I look at the variable after execution: He

Advertisement