小编kin*_*aii的帖子

如何使用 PDFsharp 创建表格?

刚开始使用 PDFsharp 并且它工作正常,但现在我想在我的 PDF 中创建表格,但尝试了其他来源并没有发现任何东西。

到目前为止,我知道如何使用graph.drawString().

vb.net pdf pdfsharp migradoc

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

Django - 如何注释不同值的 count()

我有以下模型:

\n
class Bank(model.Model):\n    name: models.CharField\n    ....\n
Run Code Online (Sandbox Code Playgroud)\n

使用以下示例数据:

\n
\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\n\xe2\x95\x91 Row ID, Name \xe2\x95\x91\n\xe2\x95\xa0\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\xa3\n\xe2\x95\x91 1, ABC       \xe2\x95\x91\n\xe2\x95\x91 2, ABC       \xe2\x95\x91\n\xe2\x95\x91 3, XYZ       \xe2\x95\x91\n\xe2\x95\x91 4, MNO       \xe2\x95\x91\n\xe2\x95\x91 5, ABC       \xe2\x95\x91\n\xe2\x95\x91 6, DEF       \xe2\x95\x91\n\xe2\x95\x91 7, DEF       \xe2\x95\x91\n\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\n
Run Code Online (Sandbox Code Playgroud)\n

我想提取不同的银行名称,如下所示:

\n
[(\'ABC\', 3), (\'XYZ\', 1), (\'MNO\', 1), (\'DEF\', 2)]\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试使用 annotate 和 distect 但出现以下错误:

\n
NotImplementedError: annotate() + distinct(fields) is not implemented.\n
Run Code Online (Sandbox Code Playgroud)\n

我还遇到了以下问题:

\n

问题1

\n

其中有关于使用的答案models.Count(\'name\', distinct=True),但它返回重复的值。\n我如何使用 Django ORM 处理这个问题?

\n

django django-orm distinct-values

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

VB.NET 中是否有 isAlpha 函数

我有一个变量来保存一个 id

Dim empId as String
Run Code Online (Sandbox Code Playgroud)

因此,有效 ID 的格式为:

'the first character should be a letter [A-Z]
'the rest of the string are digits e.g M2895 would be a valid id
Run Code Online (Sandbox Code Playgroud)

我想检查这些字符中的每一个,看看它们是否适合 ID

到目前为止,我已经遇到了这个isNumeric()功能。VB.NET 中是否有类似的函数来检查字符是字符串还是字母字符?

vb.net alpha isnumeric

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

Youtube v3 Api 通过 ID 获取视频

如何ID使用Youtube API v3.

到目前为止,我只遇到过搜索机制和其他机制,但不是专门用于获取单个视频的机制,我目前拥有的代码是:

def youtube_search(q, max_results=1,order="relevance", token=None, location=None, location_radius=None):

   youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY)

   search_response = youtube.search().list(
    q=q,
    type="video",
    pageToken=token,
    order = order,
    part="id,snippet",
    maxResults=max_results,
    location=location,
    locationRadius=location_radius

   ).execute()



  videos = []

  for search_result in search_response.get("items", []):
    if search_result["id"]["kind"] == "youtube#video":
        videos.append(search_result)
  try:
    nexttok = search_response["nextPageToken"]
    return(nexttok, videos)
  except Exception as e:
    nexttok = "last_page"
    return(nexttok, videos)
Run Code Online (Sandbox Code Playgroud)

但我发现这种方法效率不高,反而浪费时间和资源。我该怎么办呢?

youtube-api python-3.x google-client

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