草庐IT

python比赛题目

全部标签

读取时出现 Python 权限错误

importosimportrarfilefile=input("PasswordListDirectory:")rarFile=input("RarFile:")passwordList=open(os.path.dirname(file+'.txt'),"r")使用这段代码我得到了错误:Traceback(mostrecentcalllast):File"C:\Users\NickL\Desktop\Programming\PythonProgramming\RarCracker.py",line7,inpasswordList=open(os.path.dirname(file+

windows - 使用 python 在 selenium-chromedriver 中禁用地理定位

当我访问https网站时,想使用Chromedriver在Chrome中禁用自动地理定位。尝试过:fromselenium.webdriver.chrome.optionsimportOptionschromeOptions=webdriver.ChromeOptions()prefs={"profile.default_content_settings.geolocation":"2"}chromeOptions.add_experimental_option("prefs",prefs)driver=webdriver.Chrome(chrome_options=chrome_op

python - 带有 Visual Studio Code 的 Anaconda

我正在尝试将Anaconda与VSCode一起用于Python开发,但遇到了一些困难。我按照这里的步骤操作:https://docs.continuum.io/anaconda/ide_integration#python-tools-for-visual-studio-ptvs我可以确认Python在我的命令提示符下运行,因此我相信(?)它已正确添加到我的PATH中。但是,当我尝试在VSCode中进行调试时,出现错误:FailedtolaunchthePythonProcess,pleasevalidatethepath'python'Error:spawnpythonENOENT我

python - 在 Windows 中使用 python 安装字体

我正在开发一个python脚本来在Windows中安装字体列表。我有一个这样的列表,fonts_list=["/path/to/file/myFont1.ttf","/path/to/file/myFont1.ttf","/path/to/file/myFont1.ttf"]我简单地尝试过,使用shutil和os复制字体文件,然后我尝试将它添加到Windows注册表,即使有管理员权限,它也没有用。脚本的输出没有显示任何错误,但是列表中提到的Windows字体目录中没有任何字体。os.system(regadd"HKLM\SOFTWARE\Microsoft\WindowsNT\Curr

windows - 在 Windows 上的 Ubuntu 上的 Bash 上升级 python 版本?

所以我目前正在尝试升级Windows子系统上ubuntu上的bash中的python版本。但是据我了解,从命令行更新python并不容易。最后,我的unix子系统到底“在哪里”?例如,我的文件系统上是否有类似unix的部分,我可以将文件拖入其中?谢谢 最佳答案 这是一个较老的问题,但是我今天不得不做同样的事情(在我的Windows10笔记本电脑上使用python3.6)。按Windows+R(打开运行命令对话框)输入:bash+按Enter您将获得一个新的windowsbash提示窗口。首先键入lsb_release-a以检查您是否

python - Tensorflow 导入使 Python 在 Windows 上没有任何错误地崩溃

昨天我试图解决Windows上的matplotlib问题,其中包括解决frommatplotlibimportft2font错误。为此,我添加了HDF5_DISABLE_VERSION_CHECK=2。但是今天我发现,tensorflow不再起作用了:>pythonPython3.5.5|Anaconda,Inc.|(default,Apr72018,04:52:34)[MSCv.190064bit(AMD64)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>importtensorflo

不同操作系统上的python ctypes问题

我正在尝试转换C函数以供python3.6使用。代码如下:lib=ctypes.WinDLL('ftrScanAPI.dll')#providedbyfingerprintscannerclassFTRSCAN_IMAGE_SIZE(ctypes.Structure):_fields_=[("nWidth",ctypes.c_int),("nHeight",ctypes.c_int),("nImageSize",ctypes.c_int)]print('Opendeviceandgetdevicehandle...')hDevice=lib.ftrScanOpenDevice()pri

python 3 : `else` statement get executed even `if` statement was true

根据之前的问题ElsestatementexecutingeventheIFstatementisTRUE提供的建议是检查缩进。缩进在我的代码中似乎是正确的。似乎是什么问题?根据https://www.tutorialspoint.com/python/python_if_else.htmAnelsestatementcanbecombinedwithanifstatement.Anelsestatementcontainstheblockofcodethatexecutesiftheconditionalexpressionintheifstatementresolvesto0ora

python - Anaconda (Python) - Windows 10 上的 Cmder 集成

我在让Cmder通过Anaconda在Windows1064位上使用Python时遇到了一些麻烦。我让Anaconda工作得很好,测试了用matplotlib绘制一些东西,它与AnacondaPrompt一起工作得很好。但是,如果我尝试在Cmder下运行相同的.py文件,则会出现以下错误:Traceback(mostrecentcalllast):File"C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py",line16,infrom.importmultiarrayImportError:DLLload

python - 在 Python 中获取打开的窗口列表

我正在用Python编写一个应用程序,它必须能够将key或文本发送到另一个应用程序。例如,如果我打开了Firefox,我应该能够向它发送一个URL来打开它。我已经有了SendKeys模块,我也看过win32模块,但我不知道是否有办法在不打开窗口的情况下过滤掉进程。 最佳答案 通常,对于这种“GUI自动化”pyWinAuto是个好方法。我们使用它来允许对GUI应用程序进行自动化测试,它也应该让您将URL“键入”Firefox(更不用说找到它的窗口了)。 关于python-在Python中获