首页 \ 问答 \ 如何在python中打开一个url(how to open a url in python)

如何在python中打开一个url(how to open a url in python)

import urllib

fun open():
    return urllib.urlopen('http://example.com')

但是当example.com打开它不会渲染css或js。 如何在网络浏览器中打开网页?

@error(404)
def error404(error):
    return webbrowser.open('http://example.com')

我在用瓶子 给我错误: TypeError("'bool' object is not iterable",)


import urllib

fun open():
    return urllib.urlopen('http://example.com')

But when example.com opens it does not render css or js. How can I open the webpage in a web browser?

@error(404)
def error404(error):
    return webbrowser.open('http://example.com')

I am using bottle. Giving me the error: TypeError("'bool' object is not iterable",)


原文:https://stackoverflow.com/questions/4302027
更新时间:2022-08-03 06:08

最满意答案

像这样更新您的代码

if(isset($_POST['user']))
  $_SESSION['user'] = $_POST['user'];

update your code like this

if(isset($_POST['user']))
  $_SESSION['user'] = $_POST['user'];

相关问答

更多
  • 代替 '$_POST[form_e_date]','$_POST[form_e_time]','$_POST[form_e_type]','$_POST[form_e_name]' 你不应该使用 '$_POST["form_e_date"]','$_POST["form_e_time"]','$_POST["form_e_type"]','$_POST["form_e_name"]' 因为SQL注入攻击的危险。 你应该使用mysql_real_escape_string来保护自己免受这种伤害。 这会更安 ...
  • 像这样更新您的代码 if(isset($_POST['user'])) $_SESSION['user'] = $_POST['user']; update your code like this if(isset($_POST['user'])) $_SESSION['user'] = $_POST['user'];
  • 注意:未定义的变量 从PHP手册的巨大智慧: 在将一个文件包含在使用相同变量名的另一个文件的情况下,依赖于未初始化变量的默认值是有问题的。 这也是register_globals打开的主要安全隐患 。 在使用未初始化的变量的情况下,会发出E_NOTICE级别错误,但是在将元素附加到未初始化的数组的情况下不会发生。 可以使用isset()语言构造来检测变量是否已被初始化。 另外更理想的是empty()的解决方案,因为如果变量未初始化,它不会生成警告或错误消息。 从PHP文档 : 如果变量不存在,则不会生成警告 ...
  • 如果您的表单仍未提交,则会发生这种情况, 所以你需要在你的陈述之前加上一个条件,就像这样。 if(!empty($_POST) and array_key_exists("sm_value", $_POST)) { $name = mysqli_escape_string($mysqli, $_POST['sm_value']); $GetTitle = $mysqli->query("select * from sm_options where sm_value='$name'"); ...
  • 只需检查isset $ _FILES超全局变量,以防止未设置时发出通知。 if (isset($_FILES['conversionSourceFile'])) { // Do more stuff } Simply check to isset $_FILES superglobal variable to prevent notice when not set. if (isset($_FILES['conversionSourceFile'])) { // Do more stuff ...
  • 这是一个通知而不是错误,这意味着PHP告诉你它认为错误的东西,但代码是不受阻碍地执行的。 原因是如果您未在查询字符串中传递category_id ,则GET数组中的相应元素不存在。 有很多遗留的PHP代码没有检查数组元素的存在 - 在这些情况下,通常不可避免地将错误报告级别更改为简单地将通知静音。 还可以说,访问GET参数不应该触发这种通知。 但是,调整错误报告级别被认为是不好的做法,因为通知通常非常有用。 因此,在编写新代码时,请添加必要的检查,以免发生这种情况。 没有得到通知的正确方法是 if (iss ...
  • 您还可以使用可用的错误代码找到您获得的错误。 把它放在一边试一试。 You can also find what error are you getting using the Error Codes available. Put this and make a try.
  • 代替 $name = $_POST['name']; if ($_POST['submit'] && $human == '4') { 使用 $name = isset($_POST['name']) ? $_POST['name'] : ''; if (isset($_POST['submit']) && $human == '4') { Instead of $name = $_POST['name']; if ($_POST['submit'] && $human == '4') { ...
  • 为什么要剥离标签并转义布尔值? 你可以这样做: $password = (isset($_POST['password']) && $_POST['password'] == 1) ? 1 : 0; 要么: $password = isset($_POST['password']) ? (bool) $_POST['password'] : 0; Why are you stripping tags and escaping a boolean value? You could just do it l ...
  • 如果没有给定数字的公司,$ operadoraResult可以是一个空数组。 所以不会有一个指数'公司'。 尝试 if(!empty($operadoraResult)) $operadoraResult can be an empty array if there's no company with the given number. So there won't be an index 'company'. Try if(!empty($operadoraResult))

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。