title: How do I print out a set of information at once in python?
body: <p>I'm a python beginner I tried making a contact book program but this is the problem, I
  want to add search-like feature so after I add a contact name, phone number, email and store
  it to another file(contact.txt) I want to access it and print it via search.</p>
  <p>example:</p>
  <p>Name: Johan
  Phone: 036902480157
  Email: Johan@Email.com</p>
  <p>I want to access all the information regarding Johan just by typing his contact name or his phone number, how I can do that?</p>
  <p>note: I want to print the name, phone number, and email in each different line</p>
  <p>Thanks in advance</p>
  <p>my code</p>
  <pre><code>import os
  
  def head():
      print(&quot;&quot;)
      print(&quot;========================&quot;)
      print(&quot;      Contact Book      &quot;)
      print(&quot;========================&quot;)
  
  def restart():
      response = input(&quot;\nOpen menu again? (yes/no): &quot;).lower()
      if response == &quot;yes&quot;:
          task()
      else:
          print(&quot;\nSee You next time!&quot;)
  
  def task():
      head()
      done = False
      print('''1. Add Contact
  2. Search
  3. View Contact List
  4. Delete All Contact
  5. Exit''')
      while not done:
          task = input(&quot;\nWhat do You want to do? (1-5):&quot;)
          if task == &quot;1&quot;:
              print(&quot;\nAdding a new contact!&quot;)
              with open('contact.txt', 'a') as f:
                  name = input(&quot;Name: &quot;)
                  phone = input(&quot;Phone Number: &quot;)
                  if not phone.isnumeric():
                      while not phone.isnumeric():
                          print(&quot;Invalid input, please enter only a number!&quot;)
                          phone = input(&quot;Phone Number: &quot;)
                  email = input(&quot;Enter an email: &quot;)
                  f.writelines(('\n',('=' * 15),'\nName: ',name,
                                '\nPhone: ',phone,'\nEmail: ',email,'\n',('=' * 15)))
                  print(&quot;\nContact is saved!&quot;)
              done = True
              restart()
  
          elif task == &quot;2&quot;:
              with open('contact.txt', 'r') as f:
                  search = input(&quot;\nSearch: &quot;)
                  for i in f:
                      if search in i:
                          print(i)
                  else:
                      print(&quot;\nNo info was found!&quot;)
              done = True
              restart()
  
          elif task == &quot;3&quot;:
              if os.path.getsize('contact.txt') == 0:
                  print(&quot;\nNo contact info available!&quot;)
              else:
                  with open('contact.txt', 'r') as f:
                      print(&quot;\nAll Contact Info&quot;)
                      for i in f:
                          print(i,end=&quot;&quot;)
              done = True
              restart()
  
          elif task == &quot;4&quot;:
              with open('contact.txt', 'w') as f:
                  print(&quot;\nSuccesfully deleted all contact info!&quot;)
              done = True
              restart()
  
          elif task == &quot;5&quot;:
              print(&quot;See You next time!&quot;)
              break
  
          else:
              print(&quot;Invalid input please enter a single number from 1 to 5&quot;)
              restart()
     
  task()
  </code></pre>