正如TimeComplexity文档中所见,Python的list
类型实现使用数组.
因此,如果正在使用数组并且我们做了一些追加,最终您将不得不重新分配空间并将所有信息复制到新空间.
毕竟,怎么可能是O(1)最坏的情况?
我读过类似的问题,其中一个应该是答案,但是当我尝试它时,它只给出了部分解决方案.
我指的是问题:在Selenium Python中禁用图像
我的问题是我尝试了这个解决方案并且一些图像没有出现,但图像来自:
<img href="www.xxx.png">
Run Code Online (Sandbox Code Playgroud)
正在加载.有没有办法告诉firefox/selenium不要得到它?如果没有,有没有办法从我回来的dom元素中丢弃它,通过
self._browser.get(url)
content=self._browser.page_source
Run Code Online (Sandbox Code Playgroud)
例如,通过在dom树上做某种查找替换?
浏览器配置与上一个问题的浏览器相同:
firefox_profile = webdriver.FirefoxProfile()
# Disable CSS
firefox_profile.set_preference('permissions.default.stylesheet', 2)
# Disable images
firefox_profile.set_preference('permissions.default.image', 2)
# Disable Flash
firefox_profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so', 'false')
# Set the modified profile while creating the browser object
self._browser = webdriver.Firefox(firefox_profile=firefox_profile)
Run Code Online (Sandbox Code Playgroud)
- - - - - - - - - - - - - - - - - - -更正 - - - - - - -------------------------
我继续挖掘,我学到的是那个,
如果我检查文本文件,selenium/firefox组合做了我看到它,它没有带来图像,然后保持链接.
但当我这样做时:
self._browser.save_screenshot("info.png")
Run Code Online (Sandbox Code Playgroud)
我有一个24兆的文件加载了所有的img链接.
有人能解释一下这件事吗?
谢谢
我正在尝试在mac上安装jupyter,我知道mac附带安装了python版本但我还安装了brew并通过brew安装了python。
当我检查 python 位置时,我得到:
which python /usr/bin/python
当我检查 pip 位置时,我得到:
which pip
/usr/local/bin/pip
当我尝试安装 jupyter 时:
pip install install
经过长时间的安装,它尝试删除它想要升级的 python 包并失败:
关于尝试卸载 dateutil。
我认为是 mac 软件包。我尝试使用 sudo,没有任何变化。
据我所知,因为文件是不可变的。
试图用以下方法删除不可变的:
chflags uchg
。
不用找了。
我还尝试使用虚拟环境,使用:
sudo pip install virtualenvwrapper
。
但该 pip 尝试卸载另一个 python 文件夹。
有什么建议么?
谢谢