how to use the split in Python
<pre><code>import xlrd
import urllib.request

workbook = xlrd.open_workbook('test.xlsx');
sheet = workbook.sheet_by_index(0);
num_rows = sheet.nrows -1;
print(num_rows);
print('\n');
inputI=str(300);
inputP=str(15);
inputF='d';
content=sheet.cell_value(0,0);
address='http://www.google.com/finance/getprices? q='+content+'&amp;i='+inputI+'&amp;p='+inputP+'d&amp;f='+inputF;
response = urllib.request.urlopen(address);
data = response.readlines().split('\n');
print(data);
</code></pre>

<p>When I run it, it will always show that 'list' object has no attribute 'split'. what should I do to fix it? Really appreciate it. </p>

<blockquote>
  <p>The method readlines() reads until EOF using readline() and returns a list containing the lines.</p>
</blockquote>

<p>You can do something like:</p>

<pre><code>data = response.readlines()
for line in data:
    # I guess you will get byte here, so you have to convert them to utf-8
    print(line.decode("utf-8", errors='ignore').split("\n")[0])
</code></pre>

<p>And also you can use readline() to do this.</p>

python excel