how to start loop from top with condition result inside and skip other part
<p>I have in cycle, while True with different codes inside. if  I have "x" in line of text file, how skip PART 2 and start cycle from beginning, but if not "x"  I want pass PART 2 </p>

<p>how to do it in this case, can you show me please exactly with this code:</p>

<pre><code>import time

loop = 1

while True:

    try:

        print ('PART 1')

        text = open('D:\my_path\text.txt', "r")
        searchlines = text.readlines()
        for z, line in enumerate(searchlines):
            if ('y') in line:
                for l in searchlines:
                    print (z, line,' if "y" go to top, skip PART 2')
                    time.sleep(1)
                    break
            if not ('y') in line: #not sure about "if not" if needed here
                print (z, line,'not "y" pass PART 2')
                time.sleep(1)
                break
        continue
    except ValueError:
        print ("Could not convert data to an integer.")


    try:

        print ('PART 2')

    except ValueError:
        print ("Could not convert data to an integer.")

    loop += 1
    time.sleep(1)
</code></pre>

<p>looks like result "y" but no, just continue inside of cycle:</p>

<pre><code>PART 1
0 y  if "y" go to top, skip PART 2'
PART 1
0 y  if "y" go to top, skip PART 2'
</code></pre>

<p>bad result, now without y: </p>

<pre><code>PART 1
0 k if not "y" pass PART 2
PART 1
0 k if not "y" pass PART 2
</code></pre>

<p>other way with continue inside for, but same wrong results with "y" in text file:</p>

<pre><code>PART 1
0 y  if "y" go to top, skip PART 2
PART 2
</code></pre>

<p>and without "y" in text file:</p>

<pre><code>PART 1
PART 2
</code></pre>