Preface
The knowledge of the server has made me very confused. I believe there are a lot of Python developers and I have a similar experience. This article mainly introduces how to query CS Counter-Strike server information under Python, there is a need to refer to learning.
CS Counter Strike 1.5 version sample code
() t2all=sum (cpu_end _alltime) #结束时的cpu时间总和 t1busy=t1all-cpu_start_alltime.idle# Start busy = total time-idle time T2busy=t2all-cpu_end_alltime.idle "C PU usage: (end of busy time-start busy time)/(total time to end-total time to start) ' cpu_busy= (T2BUSY-T1BUSY)/(T2all-t1all) *100 # print ("CPU Usage:%0.2f"%cpu_busy+ '% ') return cpu_busy# another notation # def get_cpu_percent () : # return Psutil.cpu_percent (1) "' converts bytes number to more intuitive symbol display ' ' ' Return value:
: Self.client.connect ((self.ip,self.port)) except Oserror:print ("a socket operation was attempted to a network that cannot be connected") Self.txtBox.delete (0.0, END) self.txtBox.insert (0.0, "%s:%d connection failed ..."% (Self.ip,self.port)) Else:print ("%s connection succeeded ..."%self.ip) self.txtBox.delete (0.0, END) self.txtBox.ins ERT (0.0, "%s:%d connected successfully ..."% (Self.ip,self.port)) # The connection is successful and the other button is changed
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.