lanxi256 发表于 2018-8-16 11:13:44

早起的虫儿--Python01

"""  
Created on Mon Nov 07 20:56:16 2016
  

  
@author: Administrator
  
"""
  
#引入字符串模块
  
import string
  
print '大写字母'
  
print string.uppercase
  
print '小写字母'
  
print string.lowercase
  
print '所有字母’
  
print string.letters
  
print '数字'
  
print string.digits
  

  
#判断是否是email的格式
  
alphas = string.letters + '_'
  
nums = string.digits
  

  
print 'Welcome to the Identifier Checker v1.0'
  
print 'Testees must be at least 2 chars long.'
  
myInput = raw_input('Identifier to test: ')
  

  
iflen(myInput) > 1:
  
    if myInput not in alphas:
  
      print """ invalid:first symbol must be alphas"""
  
    else:
  
      for otherChar in myInput:
  
            if otherChar not in alphas + nums:
  
                print """invalid: remaing
  
                         symbols must be alphanumberic"""
  
            break
  
      else:
  
      ss = 'okay as an identifier'
  
      print '#' * (len(ss) + 2)
  
      print'#' + ss + '#'
  
      print '#' * (len(ss) + 2)


页: [1]
查看完整版本: 早起的虫儿--Python01