Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: name not defined error
Post: name not defined error

in below program, i try to zip the files under 1139 directory. import os import datetime import zipfile def zipt(folder): folder = os.path.abspath(folder) ver = 1 while True: zip_f = os.path.ba...
jolinchewjb General Coding Help 1 2,974 Jan-30-2019, 08:31 AM
    Thread: can't parse json file
Post: can't parse json file

I have below code: import os import datetime import json def prt_list(vdata, vtype,vcol): print("Here is listing of {}:".format(vtype)) for item in vdata: print (item[vcol]) wk_dir = '...
jolinchewjb General Coding Help 1 2,340 Jan-25-2019, 09:36 AM
    Thread: unexpected sub result after overloading operator
Post: unexpected sub result after overloading operator

I have below code to test overload of the operator, add is tested ok, sub is not ok, after P1-p3, it becomes empty set, but my sub function is correct, anyone knows why? thanks class Opera(object): ...
jolinchewjb General Coding Help 1 2,285 Jan-24-2019, 07:57 AM
    Thread: TypeError: __str__ returned non-string error
Post: RE: TypeError: __str__ returned non-string error

thanks
jolinchewjb General Coding Help 5 10,113 Jan-24-2019, 07:54 AM
    Thread: TypeError: __str__ returned non-string error
Post: RE: TypeError: __str__ returned non-string error

my question is how to translate: return f '{self.id} {self.name} : {self.comp}' in Python 3.6.1 to Python 3.5.1, i have to use Python 3.5.1
jolinchewjb General Coding Help 5 10,113 Jan-23-2019, 09:29 AM
    Thread: TypeError: __str__ returned non-string error
Post: RE: TypeError: __str__ returned non-string error

class srvinfo(object): def __init__(self,id,name=None,comp=None): self.id=id self.name=name self.comp=comp def change_usr(self,id,name,comp): self.id=id self.name=name self.comp=comp def __str__(s...
jolinchewjb General Coding Help 5 10,113 Jan-23-2019, 08:32 AM
    Thread: TypeError: __str__ returned non-string error
Post: TypeError: __str__ returned non-string error

the result is : TypeError: __str__ returned non-string (type NoneType), but i think my __str__ function is correct,any idea? thanks, this is under python 3.5.1 class srvinfo(object): def __ini...
jolinchewjb General Coding Help 5 10,113 Jan-23-2019, 06:34 AM
    Thread: class program no output under python 3.5.1
Post: class program no output under python 3.5.1

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(e...
jolinchewjb General Coding Help 1 2,372 Jan-22-2019, 09:43 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020