在Python中如何在call函数中使用变量?

2024-04-29 21:14:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Ubuntu上使用Python。 call(["xdotool", "mousemove", "500","600"])工作正常。在

但是如果x=500y=600

call(["xdotool", "mousemove", "x","y"]) 不起作用。在

x和{}的语法应该是什么?在


Tags: ubuntu语法callmousemovexdotool
2条回答

像这样用

call(["xdotool", "mousemove", str(x), str(y)])

{cd2>指向数据的变量。但是当你说,"x""y",你就是在传递数据本身。在

删除引号。如果保留引号,它将被视为字符串。在

call(["xdotool", "mousemove", "500","600"])

相关问题 更多 >