刚开始使用 PDFsharp 并且它工作正常,但现在我想在我的 PDF 中创建表格,但尝试了其他来源并没有发现任何东西。
到目前为止,我知道如何使用graph.drawString().
我有以下模型:
\nclass Bank(model.Model):\n name: models.CharField\n ....\nRun 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\nRun Code Online (Sandbox Code Playgroud)\n我想提取不同的银行名称,如下所示:
\n[(\'ABC\', 3), (\'XYZ\', 1), (\'MNO\', 1), (\'DEF\', 2)]\nRun Code Online (Sandbox Code Playgroud)\n我尝试使用 annotate 和 distect 但出现以下错误:
\nNotImplementedError: annotate() + distinct(fields) is not implemented.\nRun Code Online (Sandbox Code Playgroud)\n我还遇到了以下问题:
\n\n其中有关于使用的答案models.Count(\'name\', distinct=True),但它返回重复的值。\n我如何使用 Django ORM 处理这个问题?
我有一个变量来保存一个 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 中是否有类似的函数来检查字符是字符串还是字母字符?
如何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)
但我发现这种方法效率不高,反而浪费时间和资源。我该怎么办呢?
vb.net ×2
alpha ×1
django ×1
django-orm ×1
isnumeric ×1
migradoc ×1
pdf ×1
pdfsharp ×1
python-3.x ×1
youtube-api ×1