Python Forum
class program no output under python 3.5.1 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: class program no output under python 3.5.1 (/thread-15562.html)



class program no output under python 3.5.1 - jolinchewjb - Jan-22-2019

my python profram is as follows:
class logent(object):
 def __init__(self, s):
  self.line=s
  self.info=s.split('',5)
  
 def printline(self):
  print(self.line)
  for entry in self.info:
    print(entry)
  print()
  
  s1 = 'Mar 26 15:17:01 Steven CRON[13135]'
  lo=logent(s1)
  lo.printline()
but there is no output and no warning message, what's the wrong with this program


RE: class program no output under python 3.5.1 - Larz60+ - Jan-22-2019

class logent(object):
    def __init__(self, s):
        self.line = s
        self.info = s.split()
    
    def printline(self):
        print(self.line)
        for entry in self.info:
            print(entry)
        print()

def main():    
    s1 = 'Mar 26 15:17:01 Steven CRON[13135]'
    lo=logent(s1)
    lo.printline()

if __name__ == '__main__':
    main()
output:
Output:
Mar 26 15:17:01 Steven CRON[13135] Mar 26 15:17:01 Steven CRON[13135]