zoukankan      html  css  js  c++  java
  • python 获取随机字母

    Python2

    #-*- coding:utf-8 -*-
    import string #导入string这个模块
    print string.digits  #输出包含数字0~9的字符串
    print string.letters  #包含所有字母(大写或小写)的字符串
    print string.lowercase #包含所有小写字母的字符串
    print string.uppercase  #包含所有大写字母的字符串
    print string.punctuation #包含所有标点的字符串
    print string.ascii_letters #与string.letters一样

    Python3

    import string   # 导入string这个模块
     2 print(string.digits)  # 输出包含数字0~9的字符串
     3 print(string.ascii_letters)  # 包含所有字母(大写或小写)的字符串
     4 print(string.ascii_lowercase)  # 包含所有小写字母的字符串
     5 print(string.ascii_uppercase)  # 包含所有大写字母的字符串
  • 相关阅读:
    1004. Counting Leaves (30)
    51Nod 1272 最大距离 (栈或贪心)
    D
    M
    N
    F
    E
    L
    A. Office Keys ( Codeforces Round #424 (Div. 1, rated, based on VK Cup Finals) )
    K
  • 原文地址:https://www.cnblogs.com/gexbooks/p/10043389.html
Copyright © 2011-2022 走看看