zoukankan      html  css  js  c++  java
  • 绑定方法与非绑定方法

    # import settings
    # class MySQL:
    # def __init__(self,host,port):
    # self.host=host
    # self.port=port
    #
    # @classmethod
    # def from_conf(cls):
    # return cls(settings.HOST,settings.PORT)
    # conn=MySQL('127.1.1.1',9527)
    # conn=MySQL(settings.HOST,settings.PORT)
    '''
    绑定方法:绑定给谁就由谁来调用,谁来调用就会把谁当作第一个参数自动传入
    '''
    # conn=MySQL.from_conf()
    # print(conn.host,conn.port)
    '''
    127.1.1.1 9527
    '''
    # import time,settings,hashlib
    # class MySQL:
    # def __init__(self,host,port):
    # self.host=host
    # self.port=port
    #
    # def func(self):
    # print('%s 说:阿那他'%self.name)
    #
    # @classmethod
    # def from_conf(cls):
    # return cls(settings.HOST,settings.PORT)
    #
    # def create_id():
    # m=hashlib.md5()
    # m.update(str(time.process_time()).encode('utf-8'))
    # return m.hexdigest()

    # conn=MySQL.from_conf()
    # print(MySQL.create_id())
    '''
    time.clock在Python 3.3中已被弃用,将从Python 3.8中删除:改用time.perf_counter或time.process_time代替time.clock
    '''
    '''
    fa00eca46f5e08b1721f3d30af281e6c
    '''
    # import time,settings,hashlib
    # class MySQL:
    # def __init__(self,host,port):
    # self.host=host
    # self.port=port
    #
    # def func(self):
    # print('%s 说:阿那他'%self.name)
    #
    # @classmethod
    # def from_conf(cls):
    # return cls(settings.HOST,settings.PORT)
    #
    # @staticmethod
    # def create_id():
    # m=hashlib.md5()
    # m.update(str(time.process_time()).encode('utf-8'))
    # return m.hexdigest()
    #
    # conn=MySQL.from_conf()
    # print(MySQL.create_id)
    # print(conn.create_id)
    '''
    <function MySQL.create_id at 0x00000131324635E8>
    <function MySQL.create_id at 0x00000131324635E8>
    '''
    # print(MySQL.create_id())
    # print(conn.create_id())
    '''
    2428a4883e5dc1b29352d505666ccadf
    2428a4883e5dc1b29352d505666ccadf
    '''
    # import time,settings,hashlib
    # class MySQL:
    # def __init__(self,host,port):
    # self.host=host
    # self.port=port
    #
    # def func(self):
    # print('%s 说:阿那他'%self.name)
    #
    # @classmethod
    # def from_conf(cls):
    # return cls(settings.HOST,settings.PORT)
    #
    # @staticmethod
    # def create_id(n):
    # m=hashlib.md5()
    # m.update(str(time.process_time()+n).encode('utf-8'))
    # return m.hexdigest()
    #
    # conn=MySQL.from_conf()
    # print(MySQL.create_id(1))
    # print(conn.create_id(2))
    '''
    3a5d90e70cf774b42477bfca08f4b457
    44017e4195a5beb916e81ed57d1b6f61
    '''
  • 相关阅读:
    配置FTP服务2(vsftpd 配置虚拟账号)
    配置FTP服务(pure-ftpd安装配置测试)
    asp.net学习——Repeater控件
    C#方法,属性,和事件
    (转)AspNetPager使用方法
    WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping
    SQL Server 操作数据
    SQL Server——增、删、改、查。
    数组——求和、平均分、最值
    数组——抽奖&&句子组合
  • 原文地址:https://www.cnblogs.com/0B0S/p/12098446.html
Copyright © 2011-2022 走看看