Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

bulkan

a guest Nov 24th, 2007 542 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. class export:
  2.     def GET(self):
  3.         i = web.input()
  4.  
  5.  
  6.         users = web.select('users', vars=locals())
  7.  
  8.         csv = []
  9.         csv.append("id,name\n")
  10.         for user in users:
  11.             row = []
  12.             row.append(user.id)
  13.             row.append(user.name)
  14.  
  15.             csv.append(",".join(row))
  16.             #writer.writerow(row)
  17.        
  18.         #f.close()
  19.  
  20.         web.header('Content-Type','text/csv')
  21.         web.header('Content-disposition', 'attachment; filename=export.csv')
  22.         print "".join(csv)
  23.         return
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top