title: writing a text file to a csv file
body: <p>I have a text file that contains a sentence in each line. Some lines are also empty.</p>
  <pre><code>sentence 1
  sentence 2
  empty line
  </code></pre>
  <p>I want to write the content of this file in a csv file in a way that the csv file has only one column and in each row the corresponding sentence is written. This is what I have tried:</p>
  <pre><code>import csv
  
  f = open('data 2.csv', 'w')
  with f:
      writer = csv.writer(f)
  
      for row in open('data.txt', 'r):
          writer.writerow(row)
  import pandas as pd
  df = pd.read_csv('data 2.csv')
  </code></pre>
  <p>Supposing that I have three sentences in my text file, I want a csv file to have one column with 3 rows. However, when I run the code above, I will get the output below:</p>
  <pre><code>[1 rows x 55 columns]
  </code></pre>
  <p>It seems that each character in the sentences is written in one cell and all sentences are written in one row. How should I fix this problem?</p>