title: Python: how to create a file .txt and record information in it
body: <p>I'm trying to create a file .txt and save the information that the user gives and also open the file in python
  i'm having trouble in create the file</p>
  
  <p>here is my code</p>
  
  <pre><code>from Tkinter import *
  
  raiz = Tk()
  frame = Frame(raiz)
  
  def cadastro():
      form = Toplevel(raiz)
  
      Label(form, text='Nome: ').grid(column=0, row=0, sticky=E)
      Label(form, text='Celular: ').grid(column=0, row=1, sticky=E)
  
      nome = StringVar()
      celular = StringVar()
  
      a=Entry(form, textvariable=nome, width=15)
      a.grid(column=1, row=0, sticky=W)
      Entry(form, textvariable=celular, width=15).grid(column=1, row=1, sticky=W)
  
      def onCancel():
          form.destroy()
  
      def onOk():
          ******.insert('','end',text=nome.get(), values=celular.get())
          onCancel()
  
      Button(form, text='OK', command=onOk).grid(column=0, row=2, sticky=E)
      Button(form, text='Cancel', command=onCancel).grid(column=1, row=2, sticky=W)
  
  def listar():
  
  
  
  
  
  w = Button(raiz, text='Cadastrar',command=cadastro).grid()
  x = Button(raiz, text='Listar').grid()
  
  
  raiz.mainloop()
  </code></pre>
  
  <p>the <em>*</em>* it's where i put the file name
  Thank you very much in advance</p>