我试图环顾这个问题,但到目前为止,我发现没有修复它。我不熟悉Python,而且我和别人的脚本一起工作。我在Windows 10(64位)上。
执行此命令:\E
收到此错误:
pip install mysql-python
答案 0 :(得分:0)
您尝试安装的python模块可能需要您编译它,这使得新手的任务变得更加困难。
相反,我建议你使用像https://github.com/PyMySQL/PyMySQL这样的纯python模块 - 这样更容易安装,因为你不必编译它。
通常我建议任何尝试使用Python中的数据库的人使用SQLAlchemy,主要是因为这允许您在处理数据库时使用单个接口,而不依赖于所使用的数据库驱动程序。
阅读答案 python3 sqlalchemy pymysql connect string以了解如何通过sqlalchemy使用pymysql。
答案 1 :(得分:0)
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--Use id and name, although name isn't used in this instance, it can be useful under different circumstances-->
<form id='urlForm' name="urlForm">
<input type="text" id='url' name="url">
<!--Use an input type submit button instead, it will automatically trigger a submit event once clicked-->
<input id="submit" type="submit">
<br/>
<label>Result:
<!--Using a real output element allows you to display data with the value property or with content methods such as innerHTML or textContent-->
<output id="urlOutput"></output>
</label>
</form>
<script>
// Reference the form
var f1 = document.getElementById('urlForm');
// Reference the output
var o1 = document.getElementById('urlOutput');
// When a submit event is triggered...
f1.onsubmit = function(e) {
// Prevent the form from submitting normally
e.preventDefault();
// reference a XHR object
var req = new XMLHttpRequest();
// POST to server
req.open('POST', 'http://httpbin.org/post', false);
// reference a FormData object
var formData = new FormData(f1);
req.send(formData);
o1.value = req.response;
}
</script>
</body>
</html>