通用代理池项目,功能型函数,验证通用代理类型 2021-11-10

检查一个字符串,是否是通用代理”http”,”https”,”socks4″,”socks5″的类型,是否满足,满足判定,返回”Y”,否则,返回”N”

user@server:~$ cat tmp1221.py 
def isActiveValueType(s):
    """
        isActiveValueType(s)
        参数 s,字符串
        用途,判断字符串是否在 ["http","https","socks4","socks5"] 中
        返回值,判定为是,返回 字符串 'Y'
        返回值,判定为否,返回 字符串 'N'
    """
    vDataUnit = ["http","https","socks4","socks5"]
    if s in vDataUnit:
        return 'Y'
    else:
        return 'N'

data1 = 'somedata'
data2 = 'http'
data3 = 'socks5'
data4 = 'linux6'
v1 = isActiveValueType(s = data1)
v2 = isActiveValueType(s = data2)
v3 = isActiveValueType(s = data3)
v4 = isActiveValueType(s = data4)
print(f"{data1} - {v1}")
print(f"{data2} - {v2}")
print(f"{data3} - {v3}")
print(f"{data4} - {v4}")




user@server:~$ python3 tmp1221.py 
somedata - N
http - Y
socks5 - Y
linux6 - N
user@server:~$ 
Donate
云乞讨

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注