这是我的代码。当我运行它时,return语句不会返回任何内容。谁知道为什么?
import win32api as win
import time
import sys
def mouse_path(run):
path = []
while time.clock() < run:
cords = (win.GetCursorPos())
time.sleep(.1)
path.append(cords)
return path
mouse_path(10)
答案 0 :(得分:3)
看起来您是从.py文件运行它而不是以交互模式运行它。除交互模式外,不会显示从<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<table>
<tbody>
<tr>
<td>
<p>Element</p>
<div class='menuBtn' title='Open menu'>[ ↓ ]</div>
</td>
<td>
<ul class="menu">
<p>menu of “Element”</p>
</ul>
</td>
</tr>
</tbody>
</table>
</body>
语句返回的对象。尝试将返回的值包装在return
语句中。
print
我跑了,然后打印到屏幕上:
import win32api as win
import time
import sys
def mouse_path(run):
path = []
while time.clock() < run:
cords = (win.GetCursorPos())
time.sleep(.1)
path.append(cords)
return path
print(mouse_path(10))