print-preview 相关问题


UnboundLocalError:无法访问未与值关联的局部变量“print”?

这是代码 def takeCommand() : r = 语音识别.Recognizer() 以 voice_recognition.Microphone() 作为源: print("正在听……") r.pause_threshol...


使用 Maven 和 junit 启用预览

我正在使用模式匹配开关编写一些Java代码,这需要在多个上下文(编译器、运行时、IDE)中设置--enable-preview。此时,除了其中一个之外,我已经得到了所有内容:unit


Vite 应用程序在 DEV 中可以运行,但在 BUILD 和 PREVIEW 后不能运行 BigInt 不是一个函数

大家好,我已经被这个问题困扰了一段时间,我通过 vite config 和 tsconfig 更改尝试了许多建议的解决方案。但我在构建 m 时仍然遇到 BigInt 的问题...


数形成三角形的三元组

问题很简单;给定 n (3 <= n <= 10^5), count all triplets i, j, k (0 < i < j < k <= n) so that they can be side lengths of a non-degenerate triangle. Print the answer m...


仅从文件中读取 1 个值

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


print/repr 中显示的十六进制整数代表什么?

在如下所示的交互式会话中: >>> f=open('test.txt','w') >>> f 0x6e610 代表什么以及我能做什么


Python向http请求返回图像

我在 iis 中使用 *.py 的处理程序“c:...\python.exe %s %s”设置 python。然后想要提供像“https://.../getpng.py?no=1”这样的url来将图像流返回到html,如下所示 我在 iis 中使用 *.py 的处理程序“c:...\python.exe %s %s”设置 python。然后想要提供像“https://.../getpng.py?no=1”这样的url来将图像流返回到html,如下所示 <img src="https://.../getpng.py?no=1"> getpng.py 很简单,如下所示。 with open('C:\\inetpub\\wwwroot\\test\\test1.png', 'rb') as f: filecontent = f.read() print('Content-Type: image/png\r\n\r\n') print(filecontent ) 图片路径正确。文件内容正确。但html页面总是显示损坏的图像。 看起来“打印(文件内容)”失败了。有解决这个问题的提示吗? 我尝试了 sys.stdout.write 但这也不起作用。 还尝试了以下方法均无效 print('内容类型:图像/png ' + 文件内容 ) print('内容类型:图像/png {0}'.format(文件内容)) 您可以使用base64在网页上显示图像; import base64 with open('QR.jpg', 'rb') as image_file: base64_bytes = base64.b64encode(image_file.read()) #print(base64_bytes) base64_string = base64_bytes.decode() print(base64_string) # For insert into the img tag. 比进入html: <img src=" data:image/jpeg; data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ.... " alt="QR.jpg" />


VSCode 仅从 csv 文件读取 1 个值[已关闭]

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


读取和过滤 CSV 文件列

我正在读取数据帧并使用如下条件查找len: 将 pandas 导入为 pd gf = pd.read_csv(raw_github_csv_file_url) print(len(gf[gf["性别"]=="男"])) 我的 CSV...


如何决定torchsummary.summary(model=model.policy, input_size=(int, int, int))的'input_size'参数?

这是我的 CNN 网络,由“print(model.policy)”打印: CNN政策( (演员): 演员( (features_extractor): CustomCNN( (cnn): 顺序( (0): Conv2d(1, 32, kernel_size=(3, 3), st...


Python 代码仅从 csv 文件读取 1 个值 [已关闭]

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


如何使用VObject操作VCF触点?

假设我已经构建了一个名为 vobj 的 VObject(例如,通过 vobject.readComponents(vcfStr) 构建)并想向其添加一个新的键:值对: print('k=%s v=%s' % (k,v)) 尝试: stmnt1 = "vobj.ad...


在python中按可变长度格式化

我想使用 .format() 方法打印类似楼梯的图案。 我试过这个, 对于范围 (6, 0, -1) 内的 i: print("{0:>"+str(i)+"}".format("#")) 但它给了我以下错误: 值错误:...


使用unitpy得到错误的结果?

下面所有三个都打印相同的属性,但为什么最后一个语句打印 0 电子伏特? 导入 scipy from unitpy import U、Q、单位、数量 ... def print_properties(q): print(q.unit) ...


如何将 DMS 转换为给定格式的弧度:Python 中的 DD-MM-SS [已关闭]

我想知道如何将 DMS 从给定格式 DD-MM-SS 转换为弧度 这个“print (DMStoRAD(47-39-28))”的解应该是 0.831785 谢谢!


sed 分隔符(定界符)替换不适用于 p 命令

我尝试在 sed print 命令中用 # 分隔符替换 / 但没有成功。请看下面第三行: u@debian:~$ 回声 A | sed -n '/A/p' A u@debian:~$ 回声 A | sed -n '#A#p' u@debian:~$


在Shell脚本中获取进程的PID

我正在编写一个shell脚本,我想获取一个名为“ABCD”的进程的PID。我所做的是: process_id=`/bin/ps -fu $USER|grep "ABCD"|awk '{print $2}'` 这获取了两个进程的PID...


按钮和表单问题

我需要创建一个功能来创建自定义临时语音通道和文本通道,用户可以在其中设置他的私人房间。 @client.event 异步 def on_ready(): print('机器人在线') 等待


print() 使线程本地缓存无效?

在 Java/Kotlin 或任何 JVM 语言中,每个线程都有一个“本地内存”AKA。 “缓存”。当一个线程想要将一个变量写入内存时,它首先更新自己的值......


Java Swing 更改为 JButton 背景颜色不显示

以下程序代码是我的应用程序的精简版本。更改为 尽管 print 命令显示,但第 45、47,48 行中的背景颜色未显示 他们已经生效了...


使用 PyROOT 循环绘制多个文件夹的直方图

我想问如何解决我在lxplus(ssh服务器)上的pyROOT代码中的这个错误: 这是两个代码部分: def mkdir_p(路径): #print“制作目录:”,路径 尝试: os.mak...


字符串格式化函数中的AttributeError

我在使用以下代码片段时遇到了 AttributeError 。对于这个问题的任何帮助,我将不胜感激。 def 歌词(动物、声音): print('''老麦克唐纳有一个农场,哎呀,...


我的代码出现类型错误,其中显示 your_value1 = ((20)/miles_gallon)*dollars_gallon 。我不知道如何解决类型错误

miles_gallon = 输入() 美元_加仑 = 输入() your_value1 = ((20)/miles_gallon)*dollars_gallon 你的价值2 = 75 你的价值3 = 100 print(f'({your_value1:.2f} {your_value2:.2f} {your_value3:.2f})...


Pylance 无法识别内置的 python 函数

我的猫跑过我的键盘,现在 Pylance 无法识别 print、hex、len 和 input 等内置函数,并且它标记为未定义。同样在我的 Django 项目中,一些类的导入开始了......


我想了解Python中这段代码的逻辑

我的老师给了我这个问题:制作一个读取整数并打印它的程序。 所以我找到了这段代码: integer_number = int(input("请输入一个整数:")) print("您输入了:&quo...


意外的打印输出会干扰 PyTorch 训练运行中的 tqdm 进度条

我试图了解使用 tqdm 的进度条是如何工作的。我有一些代码如下所示: 进口火炬 导入火炬视觉 print(f"火炬版本:{火炬.__version__}")


训练过程中将Transformers中trainer.py的compute_loss中标签的值打印到终端的方法

我想通过在变压器中的trainer.py的计算损失中添加代码来将标签打印到终端。 我尝试添加 print 和 logger.info,但都不起作用。 def 计算损失(se...


使用python的mechanize自动网站登录

我正在尝试自动登录一个网站,该网站的登录表单具有以下 HTML 代码(摘录): 我正在尝试自动登录一个网站,其登录表单具有以下 HTML 代码(摘录): <tr> <td width="60%"> <input type="text" name="username" class="required black_text" maxlength="50" value="" /> </td> <td> <input type="password" name="password" id="password" class="required black_text" maxlength="50" value="" /> </td> <td colspan="2" align="center"> <input type="image" src="gifs/login.jpg" name="Login2" value="Login" alt="Login" title="Login"/> </td> </tr> 我正在使用python的mechanize模块进行网页浏览。以下是代码: br.select_form(predicate=self.__form_with_fields("username", "password")) br['username'] = self.config['COMMON.USER'] br['password'] = self.config['COMMON.PASSWORD'] try: request = br.click(name='Login2', type='image') response = mechanize.urlopen(request) print response.read() except IOError, err: logger = logging.getLogger(__name__) logger.error(str(err)) logger.debug(response.info()) print str(err) sys.exit(1) def __form_with_fields(self, *fields): """ Generator of form predicate functions. """ def __pred(form): for field_name in fields: try: form.find_control(field_name) except ControlNotFoundError, err: logger = logging.getLogger(__name__) logger.error(str(err)) return False return True return __pred 不知道我做错了什么...... 谢谢 该网站有可能在登录期间使用java脚本进行回发。我记得很清楚,对于 ASP .Net 站点,您需要获取隐藏表单字段,例如 VIEWSTATE 和 EVENTTARGET 并将它们发布到新 Page 。 您为什么不发送问题网站的链接?之后就变得相对容易弄清楚了 尝试使用 Selenium 和 PhantomJS from selenium import PhantomJS import platform if platform.system() == 'Windows': # .exe for Windows PhantomJS_path = './phantomjs.exe' else: PhantomJS_path = './phantomjs' service_args = [ # Proxy (optional) '--proxy=<>', '--proxy-type=http', '--ignore-ssl-errors=true', '--web-security=false' ] browser = PhantomJS(PhantomJS_path, service_args=service_args) browser.set_window_size(1280, 720) # Window size for screenshot (optional) login_url = "<url_here>" # Credentials Username = "<insert>" Password = "<insert>" # Login browser.get(login_url) browser.save_screenshot('login.png') print browser.current_url browser.find_element_by_id("<username field id>").send_keys(Username) browser.find_element_by_id("<password field id>").send_keys(Password) browser.find_element_by_id("<login button id>").click() print (browser.current_url) browser.get(scrape_url) print browser.page_source browser.quit() ''' python 和 pycharm 设置路径变量 点维辛检查 包管理器 python 如何安装新版本 python最新版本 - python 3.7.2 用户环境变量 蟒蛇 pyton 中的命令行 '''


Python 通配以匹配 find 的“-print -quit”行为

我有几个任意深度的目录,每个目录都包含一个具有一致名称的文件。在命令行中,我可以使用 find -name -print -quit 进行优化... 我有一些任意深度的目录,每个目录都包含一个具有一致名称的文件。在命令行中,我可以使用 find <dir> -name <filename> -print -quit 进行优化搜索:一旦找到文件,它就会停止查找目录。我可以做到这一点,因为它找到了我正在寻找的东西。 我可以使用 glob (或者我想是 os.walk)来做同样的事情。但是,一旦找到我要查找的文件,这两个选项似乎都无法停止:无论如何,它们都会索引完整目录 - globbing 会查找尽可能多的匹配项,而 os.walk 只允许我索引完成后进行过滤。 有没有办法在 Python 中获得优化的 find 行为,而不是在子进程中执行 find? 如果您使用 topdown=True 选项(默认),它不会首先生成整个层次结构;生成器一次返回一个目录。这允许您就地更改 os.walk() 值以防止其下降到某些子目录,并且还允许您尽早跳出循环。


在 Dartlang 中旋转/移动列表?

Dart 中是否有更好/更快的方法来旋转列表? 列表旋转(列表l,int i){ i = i % l.长度; 列表 x = l.sublist(i); x.addAll(l.sublist(0, ... Dart 中是否有更好/更快的方法来旋转列表? List<Object> rotate(List<Object> l, int i) { i = i % l.length; List<Object> x = l.sublist(i); x.addAll(l.sublist(0, i)); return x; } 可以简化一点 List<Object> rotate(List<Object> list, int v) { if(list == null || list.isEmpty) return list; var i = v % list.length; return list.sublist(i)..addAll(list.sublist(0, i)); } 如果您想要 shift 而不是 rotate,您可以简单地使用 removeAt 功能: List<int> list = [ 1, 2, 3 ]; int firstElement = list.removeAt(0); print(list); // [ 2, 3 ] print(firstElement); // 1 来自文档: 从此列表中删除位置 [index] 处的对象。 此方法将 this 的长度减少 1,并将后面的所有对象向下移动一个位置。 返回删除的值。 [索引]必须在 0 ≤ 索引范围内 < length. The list must be growable. 这里有一些更有用的 JS shim。 您还可以创建一个扩展以在任何地方使用它,并且具有空安全性。 extension RotateList<T> on List<T>{ List<T> rotate(int rotate){ if(isEmpty) return this; var index = rotate % length; return sublist(index)..addAll(sublist(0, index)); } }


如何选择两个td并用bs4作为单行输出?

我想获取一些数据,但我很难选择两个 td 并将输出放在它们所属的同一行上。 HTML 示例: ፳ 我想获取一些数据,但我很难选择两个td并将输出放在它们所属的同一行。 HTML 示例: <tr> <td class ='verseNumCell'> ፳ </td> <td class ='verseConentCell'> ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። </td> </tr> <tr> <td class ='verseNumCell'> ፳፩ </td> <td class ='verseConentCell'> አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ <span class='divineWord'>እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ <span class='divineWord'>እግዚአብሔር</span> አኅሰረኒ ወፈድፋደ አሕመመኒ ። </td> </tr> <tr> 我做了什么: import bs4 import requests import re url = "https://www.ethiopicbible.com/books/%E1%8A%A6%E1%88%AA%E1%89%B5-%E1%8B%98%E1%8D%8D%E1%8C%A5%E1%88%A8%E1%89%B5-1" parameters = {} response = requests.get(url, params=parameters) soup = bs4.BeautifulSoup(response.text, "html.parser") element_list = soup.find("div", class_="geezBibleChapterContainer").find_all("td") for element in element_list: text = element.get_text() text = os.linesep.join([s for s in text.splitlines() if s]) if not re.match(r'^\s*$', text): print(text) 我的输出: ፳ ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። ፳፩ አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ 我想得到什么: ፳ ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። ፳፩ አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ 我应该在单独的“汤”中选择 td 吗? 无需选择单元格,只需选择每一行并使用 get_text(separator=' ',strip=True): for row in soup.select('div.geezBibleChapterContainer tr'): print(row.get_text(' ',strip=True)) 什么导致: ፩ በቀዳሚ ገብረ እግዚአብሔር ሰማየ ወምድረ ። ፪ ወምድርሰ ኢታስተርኢ ወኢኮነት ድሉተ ወጽልመት መልዕልተ ቀላይ ወመንፈሰ እግዚአብሔር ይጼልል መልዕልተ ማይ ። ፫ ወይቤ እግዚአብሔር ለይኩን ብርሃን ወኮነ ብርሃን ። ፬ ወርእዮ እግዚአብሔር ለብርሃን ከመ ሠናይ ወፈለጠ እግዚአብሔር ማእከለ ብርሃን ወማእከለ ጽልመት ። ፭ ወሰመዮ እግዚአብሔር ለብርሃን ዕለተ ወለጽልመት ሌሊተ ወኮነ ሌሊተ ወጸብሐ ወኮነ መዓልተ ፩ ። ፮ ወይቤ እግዚአብሔር ለይኩን ጠፈር ማእከለ ማይ ከመ ይፍልጥ ማእከለ ማይ ወኮነ ከማሁ ። ፯ ወገብረ እግዚአብሔር ጠፈረ ወፈለጠ እግዚአብሔር ማእከለ ማይ ዘታሕተ ጠፈር ወማእከለ ማይ ዘመልዕልተ ጠፈር ። ፰ ወሰመዮ እግዚአብሔር ለውእቱ ጠፈር ሰማየ ወርእየ እግዚአብሔር ከመ ሠናይ ወኮነ ሌሊተ ወጸብሐ ወኮነ ካልእተ ዕለተ ። 示例 import requests import bs4 url = "https://www.ethiopicbible.com/books/%E1%8A%A6%E1%88%AA%E1%89%B5-%E1%8B%98%E1%8D%8D%E1%8C%A5%E1%88%A8%E1%89%B5-1" parameters = {} response = requests.get(url, params=parameters) soup = bs4.BeautifulSoup(response.text, "html.parser") for row in soup.select('div.geezBibleChapterContainer tr'): print(row.get_text(separator=' ',strip=True))


Python 3.7 BeautifullSoup soup.find 错误 - find() 不接受关键字参数

我从 URL 获得了以下 HTML: 我从 URL 中获得了以下 HTML: <h4> \r\n \r\n\r\n <a href="/l"> \r\n <!-- mp_trans_rt_start id="1" args="as" 1 -->\r\n <span class="brandWrapTitle">\r\n <span class="productdescriptionbrand">Mxxx</span>\r\n </span>\r\n <span class="nameWrapTitle">\r\n <span class="productdescriptionname">Axxxname</span>\r\n </span>\r\n <!-- mp_trans_rt_end 1 -->\r\n </a> \r\n\r\n </h4> 我正在尝试使用 python 来查找类名: import urllib.request from bs4 import BeautifulSoup url = "https://link" user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' urlwithagent = urllib.request.Request(url,headers={'User-Agent': user_agent}) response = urllib.request.urlopen(urlwithagent) soup = response.read() product = soup.find("h4", attrs ={"class=": "productdescriptionname"}) print (product) Everythink 完美运行直到上线: product = soup.find("h4", attrs ={"class=": "productdescriptionname"}) 我收到如下错误: find() takes no keyword arguments 我不知道如何解决它 - 有很多信息,但没有任何作用:/ 在使用 BeautifulSoup 之前,您需要将其转换为 find 对象,否则它会使用 str.find 例如: soup = BeautifulSoup(response.read(), "html.parser") product = soup.find("h4", attrs ={"class": "productdescriptionname"}) print (product) 我认为这值得一提,如果 find 方法有问题,检查 type(soup) 是一个很好的方法来查明您是否正在使用正确的 bs4.BeautifulSoup 对象而不是 str。 我想在这里指出一件事,如果使用 soup.prettify() 使 html 可读。需要注意的是,.prettify() 将 bs4.BeautifulSoup 转换为 str。所以这应该单独使用,例如: soup = BeautifulSoup(response) # type(soup) --> bs4.BeautifulSoup print(soup.prettify()) # print readable html 不喜欢: soup = BeautifulSoup(response).prettify() # type(soup) --> str 我在网上读到的关于这个问题的另一件事是这样的:“你的 beautiful soup 版本可能不支持 find。”因此,我最终升级和降级了版本很多次,然后才意识到这是一个错误的陈述由业余爱好者制作。 在打印之前我已经为此奋斗了大约 45 分钟type(soup)。我希望这可以节省其他人的时间。 Может кому подойдет история такая повторял за автором ютуба и переписывал код для парсинга и вышла такая же ошибка как в вопросе искал читал, шерстил инет пока не начал перепроверять свой код в общем мой код с ошибкой: from requests import Session from bs4 import BeautifulSoup as BS from time import sleep headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 YaBrowser/23.11.0.0 Safari/537.36'} work = Session() work.get('https://quotes.toscrape.com/', headers=headers) response = work.get('https://quotes.toscrape.com/login', headers=headers) soup = BS(response.text, 'lxml') token = soup.find('from').find('input').get('') в чем здесь ошибка? вот в этой строке token = soup.find('from').find('input').get('') а именно soup.find('from') я решил скать ошибку методом исключения поэтому довел до такого состояния и понял что в странице нет тэга '来自' а есть тэг '形式' как только поменял на тэг 'form' ошибка с soup.find() - find() ушла может кому поможет


如何从当前打开的 HTML 网站中的元素获取数据?

我发现自己需要深入研究开放网站的 HTML 代码,并从 标签获取一些数据,特别是其中的背景图像元素的值。这个元素改变... 我发现自己需要深入研究开放网站的 HTML 代码,并从 <div> 标签获取一些数据,特别是其中的 background-image 元素的值。该元素会根据页面上执行的操作而发生变化。现在我需要找出如何让我的代码从 Firefox 中打开的选项卡返回该特定元素的值。最简单的方法是什么? 我看了美丽汤,但我不知道还需要搭配什么。据我所知,它对于解析 HTML 数据很有用,但对于首先获取该数据却没有用。 您可以使用 requests 来获取页面的 HTML 内容,如下所示: import requests from bs4 import BeautifulSoup def scrape_website(url): # Send an HTTP request to the URL response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: # Parse the HTML content of the page soup = BeautifulSoup(response.content, 'html.parser') # Extract data based on HTML structure (replace with your own logic) divs = soup.find_all('div') for div in divs: print(div.text) else: print(f"Failed to retrieve the page. Status code: {response.status_code}") 这里我们向站点发送一个 HTTP 请求,如果响应是 200(等于 ok ),我们将响应中的 HTML 数据发送到变量并使用 Beatiful Soup 解析它。您需要将解析代码更改为最适合您的代码,但此时您可以询问 Chat-GPT。


QWebEngineView:html 文件中的 href 不起作用

我有一个 test.html 文件,例如: 我有一个 test.html 文件,例如: <!DOCTYPE html> <html> <head> </head> <body> <a style="padding-right:5px" target="_blank" href="data/">Datadir</a> </body> </html> 包含 test.html 的目录如下: test.html data\ a.txt b.txt 我使用“file:///remote/us01home19/ktc/public_html/testLocalHref/test.html”并在firefox和chrome中单击Datadir,结果如下: 和: 我写了一个pyside2代码来做同样的事情,代码如下: from PySide2 import QtCore, QtWidgets, QtWebEngineWidgets import os import sys class CustomWebEnginePage(QtWebEngineWidgets.QWebEnginePage): # Store second window. external_window = None def acceptNavigationRequest(self, url, _type, isMainFrame): print(url, _type, isMainFrame) if _type == QtWebEngineWidgets.QWebEnginePage.NavigationTypeLinkClicked: if not self.external_window: self.external_window = QtWebEngineWidgets.QWebEngineView() self.external_window.setUrl(url) self.external_window.show() return False return super().acceptNavigationRequest(url, _type, isMainFrame) class MainWindow(QtWidgets.QMainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.browser = QtWebEngineWidgets.QWebEngineView() self.browser.setPage(CustomWebEnginePage(self)) # self.browser.setUrl(QtCore.QUrl("https://code.visualstudio.com")) self.browser.setUrl(QtCore.QUrl("file:///remote/us01home19/ktc/public_html/testLocalHref/test.html")) # self.browser.setUrl(QtCore.QUrl("file:///remote/tw_rnd1/ktc/prog/python/pyside2/WebEngine/data/aaa.ava.summary.html")) #self.browser.setUrl(QtCore.QUrl("file:///remote/tw_rnd1/ktc/prog/python/pyside2/WebEngine/data/aaa_ava_corners/C_1")) self.setCentralWidget(self.browser) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_()) 但是执行代码,我得到的结果如下: 但是点击Datadir,没有任何反应,甚至QWebEnginePage.acceptNavigationRequest也没有触发。有没有办法让 QWebEngine 的行为像 Firefox 和 Chrome 一样? 我尝试在 QWebEnginePage.acceptNavigationRequest 函数中添加打印消息来捕获点击 dataDir 信息,但似乎没有任何响应。 python版本:python-3.9.0, 操作系统版本:“CentOS Linux 7”, Qt 版本:“Qt_5.15” python 和 Qt 是自定义构建 我发现问题来自htmltarget =“_blank”在QWebEnginePage中不起作用,它可以通过在QtWebEngineWidgets中实现类函数createWindow来避免,例如: class CustomWebEnginePage(QtWebEngineWidgets.QWebEnginePage): # Store second window. external_window = None def acceptNavigationRequest(self, url, _type, isMainFrame): print(url, _type, isMainFrame) if _type == QtWebEngineWidgets.QWebEnginePage.NavigationTypeLinkClicked: if not self.external_window: self.external_window = QtWebEngineWidgets.QWebEngineView() self.external_window.setUrl(url) self.external_window.show() return False return super().acceptNavigationRequest(url, _type, isMainFrame) def createWindow(self, t): return self;enter code here


另一个模型中的模型列表仅保存列表中所有项目中最后添加的项目

对于 (int x=0; x for (int x=0; x<listaEquipes.length; x++) { await _loadEquipe(listaEquipes[x].id.toString()); TabelaListaEquipes _reg = TabelaListaEquipes(); _reg.equipeId = listaEquipes[x].id.toString(); _reg.equipe = listaAtletaEquipe; //print (_reg.equipe![0].nome.toString()); listaEquipesGeral.add(_reg); } 此型号: class TabelaListaEquipes { String? equipeId; List<TabelaInscricoes>? equipe; TabelaListaEquipes( { this.equipeId, this.equipe}); } 现在我看到最后一个reg保存在列表的所有iten中,为什么? 这就对了: listaEquipesGeral[0].equipe == listEquipesGeral[1].equipe ...仍然添加了最后一项。为什么?? _loadEquipe 函数,它也有效,我已经测试过了, List<TabelaInscricoes> listaAtletaEquipe = []; Future<void> _loadEquipe(equipId) async { setState(() { listaAtletaEquipe.clear(); carregandoEquipe = true; }); TabelaInscricoes _result = TabelaInscricoes(); CollectionReference _dbCollection = FirebaseFirestore.instance.collection('campeonatos').doc(resultSelect.campId).collection('divisoes').doc(resultSelect.divId).collection('equipes').doc(equipId).collection('atletas'); await _dbCollection.orderBy('pos2', descending: false).get().then((QuerySnapshot querySnapshot) async { if (querySnapshot.docs.isNotEmpty) { querySnapshot.docs.forEach((element) async { _result = TabelaInscricoes.fromJson(element.data()! as Map<String, dynamic>); if (_result.campId == resultSelect.campId && _result.divId == resultSelect.divId) { _result.id = element.id; _result.filePath = ""; setState(() { listaAtletaEquipe.add(_result); }); } }); for (int x = 0; x<listaAtletaEquipe.length; x++) { for (int y = 0; y<listaAtletas.length; y++) { if (listaAtletaEquipe[x].atletaId.toString() == listaAtletas[y].id.toString()) { setState(() { listaAtletaEquipe[x].nome = listaAtletas[y].nome; listaAtletaEquipe[x].fotoNome = listaAtletas[y].fotoNome; listaAtletaEquipe[x].filePath = listaAtletas[y].filePath; listaAtletaEquipe[x].dataN = listaAtletas[y].dataN; listaAtletaEquipe[x].fone1 = listaAtletas[y].fone1; listaAtletaEquipe[x].fone2 = listaAtletas[y].fone2; listaAtletaEquipe[x].nTitulo = listaAtletas[y].nTitulo; listaAtletaEquipe[x].info = listaAtletas[y].info; listaAtletaEquipe[x].email = listaAtletas[y].email; }); } } } for (int x=0; x<listaAtletaEquipe.length; x++) { if (listaAtletaEquipe[x].fotoNome.toString().isNotEmpty) { await MyStorage.getUrl(context, "atletas/${listaAtletaEquipe[x].fotoNome.toString()}").then((value) { setState(() { listaAtletaEquipe[x].filePath = value; }); }); } } setState(() { carregandoEquipe = false; }); }else { setState(() { carregandoEquipe = false; }); } }); } AtletaEquipes 型号操作系统列表: class TabelaInscricoes{ bool? carregando = true; String? id; String? campId; String? divId; String? atletaId; String? nome_responsavel; String ?posicao; String? filePath; Uint8List? imageFile; String? usuario; String? nInscricao; String? nome; String? dataN; String? nTitulo; String? fone1; String? fone2; String? info; String? email; String? fotoNome; String? pos2; String? selected; TabelaInscricoes({ this.carregando, this.nome, this.dataN, this.nTitulo, this.fone1, this.fone2, this.info, this.email, this.id, this.campId, this.divId, this.posicao, this.nome_responsavel, this.nInscricao, this.atletaId, this.selected, this.pos2, this.fotoNome, this.filePath, this.imageFile, this.usuario}); Map<String, dynamic> toJson() => { 'campId': campId, 'divId': divId, 'atletaId': atletaId, 'nome_responsavel': nome_responsavel, 'posicao': posicao, 'usuario': usuario, 'nInscricao': nInscricao, 'pos2': pos2, 'selected': selected }; TabelaInscricoes.fromJson(Map<String, dynamic> json) : campId = json['campId'], divId = json['divId'], atletaId = json['atletaId'], nome_responsavel = json['nome_responsavel'], posicao = json['posicao'], nInscricao = json['nInscricao'], pos2 = json['pos2'], selected = json['selected'], usuario = json['usuario']; } 这里发生了什么,listaEquipesGeral 总是保存最后添加的所有项目。 我明白了,解决方案是在模型内的列表中逐项添加: for (int x=0; x<listaEquipes.length; x++) { await _loadEquipe(listaEquipes[x].id.toString()); TabelaListaEquipes _reg = TabelaListaEquipes(); _reg.equipeId = listaEquipes[x].id.toString(); _reg.equipe = []; //here above the solution, include for to put item by item, and it works for (int y = 0; y<listaAtletaEquipe.length; y++) { _reg.equipe!.add(listaAtletaEquipe[y]); } //print (_reg.equipe![0].nome.toString()); listaEquipesGeral.add(_reg); }


修改现有的.htaccess,使其忽略子域

我有以下 .htaccess 文件,虽然我知道它远非最佳(并且可能有点令人畏惧) - 它只是有效。 # 防止公众查看 .htaccess 文件 我有以下 .htaccess 文件,虽然我知道它远非最佳(而且可能有点令人难受) - 它只是有效。 # Prevents public viewing of .htaccess file <Files .htaccess> order allow,deny deny from all </Files> # Custom 404 page ErrorDocument 404 https://www.domain.com/404/ # Turn on rewriting and set rewriting base RewriteEngine On RewriteBase / # Force WWW RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} ^([^.]+)\.([a-z]{2,4})$ [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=302,L] # Force WWW and HTTPS RewriteCond %{HTTP_HOST} !^www\. [NC,OR] RewriteCond %{HTTPS} off RewriteRule ^ https://www.domain.com%{REQUEST_URI} [R=301,L] # Remove .php extension RewriteRule ^(properties)/(all|location1|location2|location3)/(all|1|2|3|4|5|6|7|8|9)/(asc|desc) $1.php?location=$2&bedrooms=$3&sort-by=$4 RewriteRule ^(properties)/(all|location1|location2|location3)/(all|1|2|3|4|5|6|7|8|9) $1.php?location=$2&bedrooms=$3 RewriteRule ^(properties)/(all|location1|location2|location3) $1.php?location=$2 RewriteRule ^(view-property)/(.*)/(print-view) $1.php?id=$2&print=true RewriteRule ^(view-property)/(.*)/ $1.php?id=$2 RewriteRule ^(.*)/$ $1.php 我们的新网站现已准备好推送到我们新创建的临时环境中进行测试。在本例中,它会是 staging.domain.com,但我们在实际访问此暂存 URL 时遇到问题。 编辑 - 只是为了澄清,问题是访问 staging.domain.com 重定向到 https://www.domain.com。 我们认为问题是由我们上面的重写规则引起的。我研究了一些可能的解决方案,包括向现有重写规则添加附加条件,例如: RewriteCond %{HTTP_HOST} !^staging\.domain\.com 或添加新的条件/规则,例如: RewriteCond %{HTTP_HOST} ^staging\.domain\.com [NC] RewriteRule ^(.*) - [L] 但不幸的是这些都不起作用。使用 .htaccess 文件确实不是我的强项,所以如果有人可以提供任何帮助,那就太好了。 附注新网站由 Laravel 5.3 提供支持,因此当我们上线时,我将摆脱重写规则(位于底部的规则)的可怕尝试! 您的顶级规则必须更改为此以删除目标 URL 中的硬编码域名: # Turn on rewriting and set rewriting base RewriteEngine On RewriteBase / # Force WWW and HTTPS RewriteCond %{HTTP_HOST} !^www\. [NC,OR] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L,NE] # Remove .php extension and rest of the rewrite rules Crypto.com 登录问题 已经是 crypto.com 登录用户?继续作为 crypto.com 登录问题用户。或者。电子邮件。密码。登录 忘记密码?没有帐户?立即注册。注册 Crypto.com NFT 帐户 · 连接您经过验证的 crypto.com 登录问题 · 提交申请成为创建者 Trezor suite 应用程序 移动版 Trezor Suite Lite 是一款免费应用程序,可让您同步和跟踪所有比特币和加密货币您手机上的帐户。适用于 Trezor 硬件钱包的新桌面和浏览器应用程序。 Trezor Suite 在可用性、安全性和隐私这三个关键支柱上带来了重大改进。


© www.soinside.com 2019 - 2024. All rights reserved.