title: How can I convert a pipe delimited text file to a csv with each data in individual columns using python
body: <p>Good Day </p>
  
  <p>I am currently trying to create program in python 2.7 that takes an input text file that looks something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/iz60n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iz60n.jpg" alt="enter image description here"></a></p>
  
  <p>and then delimits and converts the file into an Excel csv that looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/UNYD2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UNYD2.jpg" alt="enter image description here"></a></p>
  
  <p>I have tried the following:</p>
  
  <pre><code>import pandas as pd
  import easygui
  
  
  def convert():
    file = easygui.fileopenbox()
    data = pd.read_csv(file, header=None, skiprows=0)
    export = data.to_csv(r'C:\Users\micha\Desktop\Python Tools\output.csv') #index=True, header=True)
    print(convert())
  </code></pre>
  
  <p>This program yields this: </p>
  
  <p><a href="https://i.stack.imgur.com/RrGv1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RrGv1.jpg" alt="enter image description here"></a></p>
  
  <p>If anyone can help it would be much appreciated.</p>