资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

Python字典怎么在linux系统下运行

本篇内容主要讲解“Python字典怎么在linux系统下运行”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Python字典怎么在linux系统下运行”吧!

在向阳等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都做网站、网站设计 网站设计制作按需制作,公司网站建设,企业网站建设,品牌网站设计,营销型网站,成都外贸网站建设,向阳网站建设费用合理。

  1. #!/usr/bin/python  

  2. f=open(‘wordlist’, ‘w’)  

  3. def xselections(items, n):  

  4. if n==0: yield []  

  5. else:  

  6. for i in xrange(len(items)):  

  7. for ss in xselections(items, n-1):  

  8. yield [items[i]]+ss  

  9. # Numbers = 48 – 57  

  10. # Capital = 65 – 90  

  11. # Lower = 97 – 122  

  12. numb = range(48,58)  

  13. cap = range(65,91)  

  14. low = range(97,123)  

  15. choice = 0 

  16. while int(choice) not in range(1,8):  

  17. choice = raw_input(”’  

  18. 1) Numbers  

  19. 2) Capital Letters  

  20. 3) Lowercase Letters  

  21. 4) Numbers + Capital Letters  

  22. 5) Numbers + Lowercase Letters  

  23. 6) Numbers + Capital Letters + Lowercase Letters  

  24. 7) Capital Letters + Lowercase Letters  

  25. : ”’)  

  26. choice = int(choice)  

  27. poss = []  

  28. if choice == 1:  

  29. poss += numb  

  30. elif choice == 2:  

  31. poss += cap  

  32. elif choice == 3:  

  33. poss += low  

  34. elif choice == 4:  

  35. poss += numb  

  36. poss += cap  

  37. elif choice == 5:  

  38. poss += numb  

  39. poss += low  

  40. elif choice == 6:  

  41. poss += numb  

  42. poss += cap  

  43. poss += low  

  44. elif choice == 7:  

  45. poss += cap  

  46. poss += low  

  47. bigList = []  

  48. for i in poss:  

  49. bigList.append(str(chr(i)))  

  50. MIN = raw_input(“What is the min size of the 
    word? “)  

  51. MIN = int(MIN)  

  52. MAX = raw_input(“What is the max size of 
    the word? “)  

  53. MAX = int(MAX)  

  54. for i in range(MIN,MAX+1):  

  55. for s in xselections(bigList,i): f.write(”.
    join(s) + ‘\n’) 

到此,相信大家对“Python字典怎么在linux系统下运行”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


分享名称:Python字典怎么在linux系统下运行
转载注明:http://cdkjz.cn/article/ihjccd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220