我在尝试使用Pyinstaller时遇到错误.在做了一些研究后,我认为错误是由最新版本的setuptools(19.3)中的错误引起的.修复程序似乎降级为setuptools版本19.2.我的问题是降级本身.我的问题是如何在Ubuntu 15.04中降级安装工具?
我有一个 ESP32 通过 USB 端口连接到计算机。我可以使用 ESP32 使用 print 语句通过串行连接发送数据,我需要定期向 ESP32 写入命令。如何在 MicroPython 中读取 ESP32 上 COM 端口传来的内容?我尝试了以下多种变体,但均未成功:
from machine import UART
uart = UART(115200)
while 1:
if uart.any():
msg = uart.read()
print(msg)
Run Code Online (Sandbox Code Playgroud) 我需要使用位数的变量来格式化变量在 f 字符串中显示的小数位数。
n = 5
value = 0.345
print(f'{value:.4f}')
Run Code Online (Sandbox Code Playgroud)
而不是value.4f,我需要变量应该四舍五入到的小数位数value.nf在哪里n。
我试图在 pyqtgraph 中使用 PlotCurveItem 创建的两条曲线之间进行填充。
phigh = self.p2.addItem(pg.PlotCurveItem(x, y, pen = 'k'))
plow = self.p2.addItem(pg.PlotCurveItem(x, yy, pen = 'k'))
pfill = pg.FillBetweenItem(phigh, plow, brush = br)
self.p2.addItem(pfill)
Run Code Online (Sandbox Code Playgroud)
曲线项目绘制正确,但没有填充。
我正在尝试在 Python 2.7 中打开 pdf 文件、打印文件并关闭 Adobe Acrobat。
import os
fd = os.startfile("temp.pdf", "print")
os.close(fd)
Run Code Online (Sandbox Code Playgroud)
运行代码后,我os.close(fd)在行中收到以下错误:
TypeError: an integer is required
Run Code Online (Sandbox Code Playgroud) 有没有办法在 Flask 模板中将字符串格式化为货币(美元)?
示例:mystring = "10000"
我想要的结果是: mynewstring = "$10,000.00"
我试图使用 ScatterPlotItem 和“+”符号作为光标在图表周围移动“光标”。光标完美地更新了它的位置,但我不知道如何清除最后一个实例。这是我用来绘制“光标”的线。
self.cursor2 = self.p2_3.addItem(pg.ScatterPlotItem([self.xx], [self.yy], pen=None, symbol='+', color = 'b'))
Run Code Online (Sandbox Code Playgroud)
我尝试了 self.cursor2.clear() 但这没有用。任何帮助表示赞赏。
我正在尝试从字符串末尾删除换行符 \n 。
myString = Serial1.readString();
String myString_trim = xbeeString.replace("\n", "");
Run Code Online (Sandbox Code Playgroud)
使用 .trim() 或 .replace() 方法时,我不断收到此错误。
错误:
exit status 1
conversion from 'void' to non-scalar type 'String' requested
Run Code Online (Sandbox Code Playgroud) 当我用实际的列名称替换列变量时,这是有效的。不过我确实需要一个变量。当我使用变量时,出现 MySQL 语法错误。字段可以是变量吗?如果是的话,错误在哪里?
conn = self.create_connection()
cur = conn[0]
db = conn[1]
cur.execute('''
UPDATE coefficients
SET %s = %s
WHERE coef_id = %s
''' , (sql_col_name, fgi, ici))
db.commit()
Run Code Online (Sandbox Code Playgroud)
好的,这是回溯:
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''base_rpm' = 3500 WHERE coef_id = 460' at line 1")
Run Code Online (Sandbox Code Playgroud) I am trying to send data to Flask Jinja2 template and repopulate a text input inside of a form. When I do this my data gets truncated. For example:
App.py
@app.route('/test')
def test():
text = 'My long test entry'
return render_template('test.html', text=text)
Run Code Online (Sandbox Code Playgroud)
Template
<head>
<title>test</title>
</head>
<body>
<form>
test:<br>
<input type="text" name="test" value={{text}}>
</form>
</body>
Run Code Online (Sandbox Code Playgroud)
Result
I want to populate with the entire string.
python ×8
python-2.7 ×4
flask ×2
pyqtgraph ×2
arduino ×1
c++ ×1
esp32 ×1
f-string ×1
jinja2 ×1
micropython ×1
mysql-python ×1
pyinstaller ×1
python-3.6 ×1
rounding ×1
setuptools ×1
string ×1
uart ×1