小编bel*_*qua的帖子

什么是图灵完成?

"图灵完成"的含义是什么意思?

你可以给出一个简单的解释,而不会涉及太多的理论细节吗?

theory turing-machines turing-complete

461
推荐指数
8
解决办法
15万
查看次数

是否有'expect'的实现或者在python3中运行的期望类库?

我想在python3中使用类似expect的模块.据我所知,无论是pexpect还是fabric都没有使用python3.我可以使用任何类似的包吗?(如果不是,有人知道py3支持是否在任何项目的路线图上?)

不需要完全重叠的功能集.我不认为我的使用情况下,有必要在这里,但我基本上重新实现Linux的期待脚本,做一些配置提供的命令远程登录,但扩展功能.

python expect pexpect fabric python-3.x

10
推荐指数
1
解决办法
1837
查看次数

如何在Java中解析字符串?是否有类似Python的re.finditer()?

我有一个非常简单的输入字符串模式 - 大写字母,整数,大写字母,整数,...我想分隔每个大写字母和每个整数.我无法弄清楚在Java中执行此操作的最佳方法.

我已经使用Pattern和Matcher,然后使用StringTokenizer尝试了regexp,但仍然没有成功.

这就是我想要做的,用Python表示:

for token in re.finditer( "([A-Z])(\d*)", inputString):
      print token.group(1)
      print token.group(2)
Run Code Online (Sandbox Code Playgroud)

对于输入"A12R5F28",结果将是:

A

12

R

5

F

28
Run Code Online (Sandbox Code Playgroud)

python java regex parsing

5
推荐指数
1
解决办法
412
查看次数

为Sphinx生成的PDF文件添加注释的背景颜色?

我可以使用Sphinx指令生成注释.. notes::.但是,html文件中的注释具有背景颜色,而生成的PDF中的注释则没有.

如何为Sphinx生成的PDF文件添加颜色?

latex restructuredtext python-sphinx

5
推荐指数
1
解决办法
1059
查看次数

Python会在完成写入之前打开文件吗?

我正在编写一个脚本,它将轮询目录以查找新文件.

在这种情况下,是否有必要进行某种错误检查以确保文件在访问之前完全写入?

在将文件完全写入磁盘之前我不想使用文件,但因为我想从文件中获取的信息接近开头,所以似乎可以在不实现文件的情况下提取我需要的数据没有写完.

这是我应该担心的事情,还是文件被锁定,因为操作系统正在写入硬盘?

这是在Linux系统上.

python linux file

3
推荐指数
2
解决办法
1763
查看次数

django中的语法错误

导致此urls.py语法错误的原因是什么?

它说

syntax error at Line 27[(r'^xd_receiver\.html$',.....] in ursl.py.
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚问题出在哪里.

  urlpatterns = patterns('',
        # Example:
        # (r'^universityDB/', include('universityDB.foo.urls')),

        # Uncomment the admin/doc line below to enable admin documentation:
        # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
        # Uncomment the next line to enable the admin:
        (r'^admin/', include(admin.site.urls)),
        (r'^registrationForm/$','universityDB.universityDetails.views.registrationForm'),
        (r'^userDetails/$','universityDB.universityDetails.views.userDetails'),
        (r'^login/$','universityDB.universityDetails.views.login'),
        (r'^userCreated/$','universityDB.universityDetails.views.userCreated'),
        (r'^forgotPassword/$','universityDB.universityDetails.views.forgotPassword'),
        (r'^passwordRecovery/$','universityDB.universityDetails.views.passwordRecovery'),     
        (r'^accounts/profile', 'universityDB.universityDetails.views.profile'),   
        (r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver'),   
        (r'^login_facebook_connect/$', 'login_facebook_connect', name='facebook_connect_ajax'),

    )
Run Code Online (Sandbox Code Playgroud)

python django django-templates django-models django-urls

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