[Tutor] Fwd: Re: Loop in pre-defined blocks

2016-06-10 Thread Alan Gauld via Tutor
Forwarding to tutor list. Always use Reply All when responding to list mail. > Sorry, to be a little bit more descriptive. I'd like to loop from 1 to 35 > but within this loop there are divisions which I need to prefix that > particular division number. > My output would look like this: >

Re: [Tutor] Loop in pre-defined blocks

2016-06-10 Thread Jignesh Sutar
Sorry, to be a little bit more descriptive. I'd like to loop from 1 to 35 but within this loop there are divisions which I need to prefix that particular division number. My output would look like this: 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 3 2

[Tutor] Loop blocks

2016-06-10 Thread Jignesh Sutar
Is there a better way to code the below than to specify blocks as I have. Ideally I'd like to specify blocks simply as *blocks=(12,20,35)* blocks=[(1,12), (13,20), (25,35)] for i,j in enumerate(blocks): for x in xrange(blocks[i][0],blocks[i][1]+1): print i+1, x Thanks in advance. Jig

Re: [Tutor] Loop in pre-defined blocks

2016-06-10 Thread Alan Gauld via Tutor
On 10/06/16 23:43, Jignesh Sutar wrote: > Is there a better way to code the below than to specify blocks as I have. > Ideally I'd like to specify blocks simply as *blocks=(12,20,35)* > > blocks=[(1,12), (13,20), (25,35)] > for i,j in enumerate(blocks): > for x in xrange(blocks[i][0],blocks[i][

[Tutor] Loop in pre-defined blocks

2016-06-10 Thread Jignesh Sutar
Is there a better way to code the below than to specify blocks as I have. Ideally I'd like to specify blocks simply as *blocks=(12,20,35)* blocks=[(1,12), (13,20), (25,35)] for i,j in enumerate(blocks): for x in xrange(blocks[i][0],blocks[i][1]+1): print i+1, x Thanks in advance. Jig

Re: [Tutor] Command statement work well on interactive mode, which running as pf file it throws error object has no attribute '__getitem__'

2016-06-10 Thread Alan Gauld via Tutor
On 09/06/16 10:03, Joseph John wrote: > itsupport@Server-A:~$ cat ReadingDataFrom1X.py > #!/usr/bin/python > import openpyxl > wb = openpyxl.load_workbook('1XDataUserMDN.xlsx') > wb.get_sheet_names() > sheet= wb.get_sheet_by_name('SQL Results') > sheet.title > print sheet.title > print sheet['A1']