【问题标题】:Randomly Picking a number within a Range of 1-1680 [duplicate]在1-1680范围内随机选择一个数字[重复]
【发布时间】:2014-07-09 15:15:43
【问题描述】:

我试图用这个脚本做的是为鼠标创建绳索,但我希望 X 绳索移动到 0-1670 范围内的位置。

import win32api
import win32con


def move(x,y):
    win32api.SetCursorPos((x,y))


move(1670,955)

任何帮助都会很棒!

【问题讨论】:

标签: python winapi python-2.7 syntax


【解决方案1】:
import random

move(random.randint(0, 1670), 955)

【讨论】:

    【解决方案2】:

    根据https://docs.python.org/2/library/random.html

    我是random.randrange(start, stop[, step]),所以

    random.randrange(0, 1670)
    

    Google 和 docs 是你的朋友,学会使用它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多