using string.strip() in python to extract specific coloumns
Question: 
    import requests
    from bs4 import BeautifulSoup
    f = open('path to create /Price.csv','w')
    errorFile = open('path to create /errorPrice.txt','w')
    year = 2012; month = 1; day =1
    if year<= 2016:
        if day > 32:
            month += 1
            day = 1
        if month >12:
            year += 1
            month = 1
        url = 'http://nepalstock.com.np/main/todays_price/index/1/stock-name/desc/YTozOntzOjk6InN0YXJ0RGF0ZSI7czoxMDoiMjAxNi0wNi0wOSI7czoxMjoic3RvY2stc3ltYm9sIjtzOjA6IiI7czo2OiJfbGltaXQiO3M6MjoiNTAiO30?startDate='+str(year)+'-'+str(month)+'-'+str(day)+'&stock-symbol=&_limit=500'
        res = requests.get(url)
    
        soup = BeautifulSoup(res.text, 'lxml')
    
        for child in soup.findAll('table'):
                for row in child.findAll('tr')[2:]:
                    for col in row.findAll('td'):
    
                        try:
                            SN = col[3].string.strip()
                            f.write(SN+'\n')
    
                        except Exception as e:
                            errorFile.write (str(day) + '*************'+ str(e)+'***********************'+ str(col)+'\n')
                            pass
            #day += 1
    f.close
    errorFile.close   
    

'I wanted to extract col[3] but it wouldn't work and shows nothing I can
traceback in error file although I am a complete noob and maybe mistaken on
that bit.'


Answer: A few things about your code before your actual error:

Use the [`with`](http://effbot.org/zone/python-with-statement.htm) statement
to open files. Manually opening and closing files is unnecessary.

Use `res.content` instead of `res.text` if you do not plan on printing the web
page. If you are passing the page source to another function like `soup.parse`
always use `res.content`.

About your problem:

`row.findAll('td')` is the list of all the table data, from wich you need the
3d index, so you do not need to iterate over it.

Just use it like this:

    
    
    for child in soup.findAll('table'):
        for row in child.findAll('tr')[2:-4]:
            cols = row.findAll('td')
            SN = cols[3].string.strip()
            print(SN)
    

Also, as you can see by the `-4` the last 4 rows do also not contain any data.

