Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78317

Re: how to make return(self.res) not to output the content of list ?

Date 2014-09-25 08:11 +0800
From luofeiyu <elearn2014@gmail.com>
Subject Re: how to make return(self.res) not to output the content of list ?
References <5422CD52.8060501@gmail.com> <lvurpl$fcv$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.14335.1411603928.18130.python-list@python.org> (permalink)

Show all headers | View raw


`sys.displayhook = lambda obj: None ` will block everything to be displayed on the interactive python console .

i rewrite my code as the following :

import sqlite3,os,jinja2
db = r'data.sqlite'
con = sqlite3.connect(db)
cur = con.cursor()

class status():
      def __init__():
          import sys
          sys.displayhook=mydisplay
      
      def mydisplay(x):
          if (x is not the result of an method grow of class status ) : x  #how to do in python code?
          else : pass
  
      def grow(self):
          self.res=  a data ananlyse process
          return(self.res)
     
      def display(self):
          #to display it in the html table



how to fulfill the mydisplay function in python code to make x.grow() in the following not to output the list of self.res??


import analyse
x=analyse.status()
x.grow()

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: how to make return(self.res) not to output the content of list ? luofeiyu <elearn2014@gmail.com> - 2014-09-25 08:11 +0800

csiph-web