小编Ed *_*d L的帖子

检查密码强度的最佳方法是什么?

在注册或更改密码表单中,确保用户提供密码的最佳方法是什么?

我有一个想法(在python中)

def validate_password(passwd):
    conditions_met = 0
    conditions_total = 3
    if len(passwd) >= 6: 
        if passwd.lower() != passwd: conditions_met += 1
        if len([x for x in passwd if x.isdigit()]) > 0: conditions_met += 1
        if len([x for x in passwd if not x.isalnum()]) > 0: conditions_met += 1
    result = False
    print conditions_met
    if conditions_met >= 2: result = True
    return result
Run Code Online (Sandbox Code Playgroud)

security passwords algorithm

43
推荐指数
3
解决办法
3万
查看次数

使用装饰器向__all__添加名称是一个好习惯吗?

这是Python中的一个好习惯(来自Active State Recipes - Public Decorator)吗?

import sys

def public(f):
  """Use a decorator to avoid retyping function/class names.

  * Based on an idea by Duncan Booth:
  http://groups.google.com/group/comp.lang.python/msg/11cbb03e09611b8a
  * Improved via a suggestion by Dave Angel:
  http://groups.google.com/group/comp.lang.python/msg/3d400fb22d8a42e1
  """
  all = sys.modules[f.__module__].__dict__.setdefault('__all__', [])
  if f.__name__ not in all:  # Prevent duplicates if run from an IDE.
      all.append(f.__name__)
  return f

public(public)  # Emulate decorating ourself
Run Code Online (Sandbox Code Playgroud)

一般的想法是定义一个装饰器,它接受一个函数或类,并将其名称添加到__all__当前模块的名称.

python coding-style

20
推荐指数
2
解决办法
3263
查看次数

有没有办法在python中将Wikitext转换为Markdown?

是否有一个python库,它采用wikitext(在mediawiki中使用)输入并将其转换为markdown?

python markdown mediawiki text-processing

14
推荐指数
2
解决办法
6803
查看次数

如何将intersphinx链接放入标准库文档中的任意方法?

我正在尝试使用Sphinx来记录项目,但我无法弄清楚如何使用intersphinx.我用这行:

:py:meth:`math.sin`
Run Code Online (Sandbox Code Playgroud)

添加链接,但在输出中,它显示为粗体,而不是链接.虽然该行不起作用,但以下两者都有效:

:py:meth:`dict.items`
:py:class:`zipfile.ZipFile`
Run Code Online (Sandbox Code Playgroud)

我在conf.py文件中的intersphinx_mapping值是:

intersphinx_mapping = {'python':('http://docs.python.org/2.7', None)}
Run Code Online (Sandbox Code Playgroud)

python documentation python-sphinx

9
推荐指数
2
解决办法
4113
查看次数

访问核心转储中的 Python 对象

无论如何,有没有办法从 gdb 中的 corefile 中发现 PyObject* 的 python 值

python postmortem-debugging python-c-api

3
推荐指数
1
解决办法
1152
查看次数