假设我有一些期货:
f = concurrent.futures.Future()
data = [f]
Run Code Online (Sandbox Code Playgroud)
最后我想把它们转储到JSON中,我保证期货在那个时候得到了解决:
f.set_result(42)
json.dumps(data)
Run Code Online (Sandbox Code Playgroud)
我怎么能嫁给这两个人?
我正在尝试从我的 raspberry PI 通信到一个 teensy(一个 arduino,可以假装为那些没有经验的人的鼠标和键盘)。
我想接收有关 arduino 的信息,并根据该信息移动鼠标。
在arduino方面,我制作了这个测试脚本:
void setup() {
Serial1.begin(9600); // According to the Teensy Docs, this is the RX1 & TX1 on my board.
// Serial itself corrosponds to the micro-usb port
}
String msg = "";
void loop() {
if(Serial1.available() > 0) {
msg = "";
while(Serial1.available() > 0) {
char read = Serial1.read();
msg += read;
}
Serial1.write('X'); // Acknowledge with reply
}
Serial1.println(msg); // Output to console for debugging
// Should be …Run Code Online (Sandbox Code Playgroud) 我想制作一个Python脚本:
打开一个文件,执行命令i,
然后编写2行代码,点击escape
执行命令ZZ。
我正在考虑 os.system("code") 的思路os.system("vi program") then os.system("i"),但这不起作用,因为你只能执行命令。谢谢你!
python ×3
python-3.x ×2
arduino ×1
future ×1
json ×1
raspberry-pi ×1
serial-port ×1
teensy ×1
vim ×1