0

I have written a loop with a while condition which iterates through rows of an excel spreadsheet, gets the values and stores them in a dictionary. When assigned conditions of the while loop are not met, it obviously breaks. I am interested in the following:

  1. getting the row number where the loop has broken
  2. restarting the loop from the break point in order to send the values from the spreadsheet to a new dictionary

Can anybody please provide an example of a code allowing to do so?

  • 2
    Add snapshot of your code. – skr Jul 21 '17 at 16:16
  • @skr, would love to, but I can't. There are confidentiality issues with some math functions in it :( – Ali Abbasov Jul 21 '17 at 16:24
  • code please ! ! ! – babygame0ver Jul 21 '17 at 16:25
  • 2
    @AliAbbasov add minimal example then... also you may want to make use of Python scoping rules to get the last row easily – user3012759 Jul 21 '17 at 16:26
  • @AkshayKathpal, see the answer to the comment above, please :) – Ali Abbasov Jul 21 '17 at 16:27
  • No one is copying your code @AliAbbasov . by the way it's open source platform – babygame0ver Jul 21 '17 at 16:30
  • @AkshayKathpal, I am not worried that someone will copy it :) Don't think it's a great code anyway. Exactly, I cannot publish someone's intellectual property at an open source platform :) – Ali Abbasov Jul 21 '17 at 16:32
  • 1
    Welcome to Stack Overflow! You seem to be asking for someone to write some code for you. Stack Overflow is a question and answer site, not a code-writing service. Please [see here](http://stackoverflow.com/help/how-to-ask) to learn how to write effective questions. – Rodrigo Leite Jul 21 '17 at 16:34
  • @user3012759, will try to write up an example (just takes a bit of time) if nobody is able to help me based on my description. Could you, please, elaborate on how to use the scoping rules for that or give a reference? :) – Ali Abbasov Jul 21 '17 at 16:35
  • @AliAbbasov https://stackoverflow.com/questions/3611760/scoping-in-python-for-loops – user3012759 Jul 21 '17 at 16:37
  • @RodrigoLeite, Thank you :) I am not asking someone to write a code for me. I am just asking to give me an example of code or a hint.To be honest, I think I stated my questions clear enough :) I know, it is recommended to write my code here, but I have clear reasons (stated in my previous comments) for not being able to do so. – Ali Abbasov Jul 21 '17 at 16:40
  • If you can't provide the code you want help with, how are we supposed to identify what's wrong? Unless you want us to develop the logic for you, in which case that is most definitely writing code for you. – Rodrigo Leite Jul 21 '17 at 17:04
  • @RodrigoLeite, mate, there is nothing wrong in the code simply because I don't know how to write the bit I am asking about. As you can see from my question, I have got the logic of what I am trying to do. What I am asking is what are the methods/ways of doing it... – Ali Abbasov Jul 21 '17 at 17:27
  • If you do have the logic down, then why can't you express it in code? You know what you *want* to do, but you want us to write the *how* for you. – Rodrigo Leite Jul 21 '17 at 17:30
  • Welcome to the site: you may want to read [help/on-topic], [ask] and [mcve], and re-word your question accordingly. – boardrider Jul 22 '17 at 22:54

0 Answers0