title: Python: How can I search a text file for a string input by the user that contains an integer?
body: <p>This is an example of what is on the text file that I am searching:</p>
  
  <pre><code>15 - Project `enter code here`Name
  APP_IDENTIFIER=ie.example.example
  DISPLAY_NAME=Mobile Banking
  BUNDLE_VERSION=1.1.1
  HEADER_COLOR=#72453h
  ANDROID_VERSION_CODE=3
  
  
  20 - Project Name
  APP_IDENTIFIER=ie.exampleTwo.exampleTwp
  DISPLAY_NAME=More Mobile Banking
  BUNDLE_VERSION=1.2.3
  HEADER_COLOR=#23456g
  ANDROID_VERSION_CODE=6
  </code></pre>
  
  <p>If, for example, the user types in 15, I want python to copy the following info:</p>
  
  <pre><code>ie.example.example
  Mobile Banking
  1.1.1
  #72453h
  3
  </code></pre>
  
  <p>because I need to copy it into a different text file.</p>
  
  <p>I get the user to input a project number (in this example the project numbers are 15 &amp; 20) and then I need the program to copy the app_identifier, display_name, bundle_version and android_version of the project relating to the number that the user input.</p>
  
  <p>How do I get python to search the text file for the number input by the user and only take the needed information from the lines directly below that specific project?</p>
  
  <p>I have a whole program written but this is just one section of it.
  I don't really have any code yet to find and copy the specific information I need.
  Here is code i have to search for the project ID </p>
  
  <pre><code>while True: 
      CUID = int(input("\nPlease choose an option:\n"))
      if (CUID) == 0:
          print ("Project one")
          break
      elif (CUID) == 15:
          print ("Project two")
          break
      elif (CUID) == 89:
          print ("Project three")
          break
      else:
          print ("Incorrect input")
  </code></pre>
  
  <p>The solution thanks to Conor:</p>
  
  <pre><code>projectFile = open("C:/mobileBuildSettings.txt" , "r")
  for line in projectFile:
      CUID = str(CUID)
      if CUID + " - " in line:
              appIdentifier = next(projectFile).split("=")[1]
              displayName = next(projectFile).split("=")[1]
              bundleVersion = next(projectFile).split("=")[1]
              next(projectFile)
              androidVersionCode = next(projectFile).split("=")[1]
  
              print (appIdentifier, displayName, bundleVersion,     androidVersionCode)
  
              break
  </code></pre>