
python
文章平均质量分 71
cyendra
Azarath Metrion Zinthos
展开
-
争做python小能手(一)
通过在 Codeforces 上用 Python 过题来增加对 python 的理解。 ------------------------------------ CodeForces 208A -- s = raw_input() a = s.split('WUB') for t in a: if t!='': print t, -- 1、 raw_input()读取一行输入原创 2014-03-09 15:22:55 · 827 阅读 · 0 评论 -
【python】统计文本中出现最多次的单词
题目来自 hacker.org 中的 Challenge '3280' [Coding] 。 要求找出 RFC 3280 中出现次数最多的长度为9的单词。 将 RFC 3280 的文本并保存到本地后用如下代码进行处理。 ---- import re text = open("in.txt",'r').read() words = re.split('[^a-zA-Z]',text) di原创 2014-03-18 18:46:25 · 4243 阅读 · 0 评论 -
【python】将01组成的密码用ASCII编码成字符串
题目来自 hacker.org 的 Challenge 'Didactic Bytes' [Crypto] 给出一个01串组成的密码,求出破译后的单词 01110101 01110011 01100101 00100000 01110111 01100101 01100100 01101110 01100101 01110011 01100100 01100001 01111001 00100原创 2014-03-18 19:20:05 · 2302 阅读 · 0 评论 -
【python】比较字符串中不同的地方
题目来自 hacker.org 的Challenge 'Didactic Text' [Crypto] 分析给出的文章,找出暗语。 Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the原创 2014-03-18 20:55:21 · 5296 阅读 · 0 评论 -
【python】optparse 模块
Python 有两个内建的模块用于处理命令行参数: 一个是 getopt,《Deep in python》一书中也有提到,只能简单处理 命令行参数; 另一个是 optparse,它功能强大,而且易于使用,可以方便地生成标准的、符合Unix/Posix 规范的命令行说明。 示例 下面是一个使用 optparse 的简单示例: Python代码 f转载 2014-03-26 18:58:35 · 653 阅读 · 0 评论 -
【python】__all__
__all__ 用于限制模块的导入 from module import * 若 module 中定义了 __all__ 属性,则只有 __all__ 中指定的内容被导入。 否则导入 module 中的所有内容。原创 2014-03-26 19:16:11 · 634 阅读 · 0 评论 -
python语法笔记
【os.getpid(), os.fork()】原创 2014-05-20 17:02:32 · 594 阅读 · 0 评论