小编Ste*_*uch的帖子

如何在 Telegram BotFather 中设置创建的游戏的 Url?

我在 BotFather Telegram 中创建了一个新游戏。但是没有关于游戏链接的任何问题。此外,在“sendGame”函数中没有任何参数来设置游戏网址。如何在 BotFather 创建的游戏后面设置我的 gameUrl?

我应该说,我正在使用 Microsoft Bot Framework 来开发我的机器人。

webhooks telegram-bot botframework telegram-webhook

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

我得到'延续线缩进为视觉缩进'错误

continuation line under-indented for visual indent在下面的代码中收到错误:

    command = 'ffmpeg -i downloaded.mp4 -codec:v libx264 -codec:a \
            aac -map 0 -f ssegment -segment_format mpegts \
            -segment_list %s/%skbps.m3u8 -segment_time 10 \
            %s/%skbps_%%03d.ts' % (path, options['video_bitrate'],
                path, options['video_bitrate'])
Run Code Online (Sandbox Code Playgroud)

如何格式化此代码以删除错误?

python pep8

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

如何将 Python 单击的默认选项设置为 -h?

如何将 Python 单击的默认选项设置为 -h?

默认情况下,我的脚本在没有提供参数时不显示任何内容duh.py

import click


CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])

@click.command(context_settings=CONTEXT_SETTINGS)
@click.option('--toduhornot', is_flag=True, help='prints "duh..."')
def duh(toduhornot):
    if toduhornot:
        click.echo('duh...')

if __name__ == '__main__':
    duh()
Run Code Online (Sandbox Code Playgroud)

[出去]:

$ python3 test_click.py -h
Usage: test_click.py [OPTIONS]

Options:
  --toduhornot  prints "duh..."
  -h, --help    Show this message and exit.



$ python3 test_click.py --toduhornot
duh...


$ python3 test_click.py 
Run Code Online (Sandbox Code Playgroud)

题:

如上图,默认不打印信息python3 test_click.py

有没有办法,-h如果没有给出参数,则默认选项设置为,例如

$ python3 test_click.py 
Usage: test_click.py [OPTIONS]

Options:
  --toduhornot  prints "duh..."
  -h, --help    Show this message and exit.
Run Code Online (Sandbox Code Playgroud)

python command-line-interface argparse python-click

6
推荐指数
3
解决办法
2516
查看次数

Solaris 门的 Linux 实现

我正在将一些 Solaris 代码移植到 Linux。此代码使用 Solaris 特定的门函数。

Linux 有等效的吗?我找到了几个例子,但它们似乎已经很多年没有更新了。

http://www.rampant.org/doors

http://sourceforge.net/projects/ldoor

linux solaris

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

Python Treeview滚动条

我的环境是使用Python 64位3.4的Windows 7.我试图将滚动条附加到树视图小部件.我尝试了几个版本,但一直无法使用它.到目前为止我尝试了什么:

# treeview example
from tkinter import ttk
from tkinter import *

# Create instance
win = Tk()

# Add a title       
    win.title("Treeview Test")

# Add a treeview
    tree = ttk.Treeview(win,selectmode='browse')
    vsb = ttk.Scrollbar(orient="vertical",command=tree.yview)
    tree.configure(yscrollcommand=vsb.set)

    tree.place(x = 30, y = 95)
    tree["columns"] = ("1", "2")
    tree['show'] = 'headings'
    tree.column("1", width=100, anchor='c')
    tree.column("2", width=100, anchor='c')
    tree.heading("1", text="Account")
    tree.heading("2", text="Type")
    tree.insert("",'end',text="L1",values=("Big1","Best"))
    tree.insert("",'end',text="L2",values=("Big2","Best"))
    tree.insert("",'end',text="L3",values=("Big3","Best"))
    tree.insert("",'end',text="L4",values=("Big4","Best"))
    tree.insert("",'end',text="L5",values=("Big5","Best"))
    tree.insert("",'end',text="L6",values=("Big6","Best"))
    tree.insert("",'end',text="L7",values=("Big7","Best"))
    tree.insert("",'end',text="L8",values=("Big8","Best"))
    tree.insert("",'end',text="L9",values=("Big9","Best"))
    tree.insert("",'end',text="L10",values=("Big10","Best"))
    tree.insert("",'end',text="L11",values=("Big11","Best"))
    tree.insert("",'end',text="L12",values=("Big12","Best"))

# Set Window Form Size and disable resizing …
Run Code Online (Sandbox Code Playgroud)

python treeview tkinter scrollbar

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

Gunicorn服务器启动错误

在外部服务器上,我尝试运行以下命令:

gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', …
Run Code Online (Sandbox Code Playgroud)

python wsgi gunicorn server

5
推荐指数
3
解决办法
6920
查看次数

如何在cmd中安装多个whl文件

我知道如何*.whl通过 cmd安装文件(代码很简单python -m pip install *so-and-so-.whl)。但是由于我不小心删除了我的操作系统并且没有备份,我发现自己陷入困境,需要为我的工作重新安装所有 whl 文件。

这大约有 50 个文件。我可以手动执行此操作,这非常简单,但我想知道如何在一行中执行此操作。我似乎找不到任何可以让我简单地输入python -m pip install *so-and-so.whl以查找目录中的所有 whl 文件并安装它们的东西。

有任何想法吗?

python cmd

5
推荐指数
2
解决办法
7110
查看次数

在字符串拆分期间删除空条目

当前,我使用此帮助器功能删除空条目。

有内置的方法吗?

def getNonEmptyList(str, splitSym):
    lst=str.split(splitSym)

    lst1=[]
    for entry in lst:
        if entry.strip() !='':
            lst1.append(entry)

    return lst1
Run Code Online (Sandbox Code Playgroud)

python python-3.x

5
推荐指数
2
解决办法
1580
查看次数

Spring MVC 响应标头:ETag 对 GET 请求有双引号,但对 PUT 请求没有

我们在我们的服务中将 Spring MVC 从 4.0 升级到 4.3。它导致“GET”方法的响应标头中的 ETag 格式更改。进行“GET”调用的客户端将在响应标头中获得带有双引号的 ETag。以前响应头中的 ETag 没有“GET”方法的双引号。

例如:

Now: etag ?"TVMzTWFpbmxpbmVEZXZvLTI5ODIxMQ" 
Previously: etag ?TVMzTWFpbmxpbmVEZXZvLTI5ODIxMQ
Run Code Online (Sandbox Code Playgroud)

"PUT" 请求的响应在 Headers 中的 ETag 周围没有双引号,就像以前一样。

任何人有任何想法为什么?

etag spring get put spring-mvc

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

Spring 批处理表清除

清除 Spring Tables 的最佳方法是什么?

Spring 是否提供任何用于清除的APIS ?或者,我们是否需要对所有 Spring Batch 表执行删除语句?

spring-batch spring-batch-admin

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