小编ade*_*ora的帖子

Python - 从pdf中提取格式化文本(即粗体,斜体,颜色)

是否有任何Python库允许从PDF中提取文本,但保留格式(即粗体,斜体,下划线,颜色等)?

我已经研究过各种选项,pdfminer但据我所知,他们只提取原始文本.

python pdf formatting extraction

8
推荐指数
0
解决办法
2536
查看次数

通过 jQuery AJAX POST 数据到 Python CGI 脚本

我正在尝试设置一个简单的脚本,其中使用 jQuery .ajax 函数将一些数据发送到 Python CGI 脚本。Python 脚本只会将发布到它的数据设为大写,然后将该数据返回到 HTML 文件,其中的 div 将使用内容更新。

我有下面显示的代码。当我运行它时,AJAX 调用会执行,但div 没有更新内容。div 不会随着发送的数据而更新。

我将如何修改此代码,以便它随着发送的数据进行更新?

我很感激任何帮助。

我的 HTML 代码:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <title>Python-jQuery Example</title>
    <script src="http://code.jquery.com/jquery-2.0.3.js"></script>
    <script>
        $(function()
        {
            $.ajax({
                url: "http://localhost/cgi-bin/post.py",
                type: "post",
                datatype: "html",
                data: "here is data",
                success: function(response){
                        $("#div").html(response);
                        console.log("There is a response"); 
                }
            });
        });

    </script>
</head>
<body>
    <div id="div">Default Stuff</div>
</body>
Run Code Online (Sandbox Code Playgroud)

我的 Python 代码:

#!/usr/bin/python

import cgi, cgitb 
cgitb.enable() 

data = cgi.FieldStorage()

print "Content-Type: text/html"
print …
Run Code Online (Sandbox Code Playgroud)

javascript python jquery cgi

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

标签 统计

python ×2

cgi ×1

extraction ×1

formatting ×1

javascript ×1

jquery ×1

pdf ×1