ok, I solved my problem :) , I missed a ) thank you On 19 Tháng Ba, 20:51, tandnk50 <[email protected]> wrote: > ok, this is my action code. I want import data > > def read_xls(): > exec('import applications.%s.modules.xlrd as xlrd' % > request.application) > import os > path=os.path.join > (request.folder,'private','a_dummy_file_name.xls') > book = xlrd.open_workbook(path) > sh = book.sheet_by_index(0) > table=request.vars['select'] > students={} > field=len(db[table].fields)-1 > if (sh.ncols <> field): > response.flash='select table again' > redirect(URL(r=request,f='view_xls')) > > for col,field in enumerate(db[table].fields): > for row in range(sh.nrows): > if (row==0): > db[table].insert(field=sh.cell_value(row,col)) > table_id[str(col)]=db[table].id > continue > db(db[table].id==table_id[str(col)] > [table].insert(field=sh.cell_value(row,col)) > students=db().select(db[table].ALL) > > return dict(students=studens) > > On 19 Tháng Ba, 20:47, DenesL <[email protected]> wrote: > > > > > Can you show the action's whole source?. > > > On Mar 19, 9:38 am, tandnk50 <[email protected]> wrote: > > > > I'm sorry . > > > But my above code writeen in a action, the 'return dict()' is for the > > > action > > > > On 19 Tháng Ba, 20:34, DenesL <[email protected]> wrote: > > > > > return may only occur syntactically nested in a function definition, > > > > you don't have one. > > > > > On Mar 19, 9:06 am, tandnk50 <[email protected]> wrote:> I wrote > > > > statements but invalid syntax and i don't know the problem, > > > > > for example : > > > > > def func(): > > > > for i in range(3): > > > > > > for j in range(2): > > > > > if i>1 : > > > > > print i > > > > > else: > > > > > print j > > > > > return dict() (or any statement ( eg, print 'hello')..) > > > > > > but invaliad syntax at return ... > > > > > ?? > > > > > how do i fix ?
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

