小编Anu*_*rma的帖子

语法错误:不是机会

我尝试在python IDLE中执行以下代码

from __future__ import braces 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

SyntaxError: not a chance
Run Code Online (Sandbox Code Playgroud)

上述错误是什么意思?

python syntax-error curly-braces

104
推荐指数
2
解决办法
3万
查看次数

python 2.7.3和python 3.3之间的区别

我在python 2.7.3中有以下python代码,我最近使用的是具有python 3.3的新笔记本电脑,我认为我不应该降级回python 2.7.3.代码是

: -

nm = input(“enter file name “)

str = raw_input(“enter ur text here: \n”)

f = open(nm,”w”)

f.write(str)

f.close()

print “1.See the file\n”

print “2.Exit\n”

s = input(“enter ur choice “)

if s == 1 :

   fi  = open(nm,”r”)

   cont  = fi.readlines()

for i in cont:

    print i

else :

    print “thank you “ 
Run Code Online (Sandbox Code Playgroud)

请告诉我我应该做出哪些更改,以便它可以轻松运行而不会出现任何错误.

python python-3.x

9
推荐指数
2
解决办法
2万
查看次数

更改网页中的鼠标指针

我用html在html中创建了一个框架

<frame></frame>
Run Code Online (Sandbox Code Playgroud)

标签.有没有办法可以在鼠标进入框架时更改鼠标指针.

html javascript css jquery html5

8
推荐指数
3
解决办法
3857
查看次数

如何在对话框JQUERY UI中打开URL

我一直在寻找一个简单的解决方案.我希望在JQuery UI对话框窗口中显示一个页面(例如http://www.google.com).计划是稍后动态添加URL,以便我站点中的所有链接都显示在所述窗口中.

我尝试了以下操作,但单击链接时对话框窗口为空.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test</title>


<meta charset="utf-8" />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
  <script>
$(document).ready(function() {
    $('#openwindow').each(function() {
        var $link = $(this);
        var $dialog = $('<div></div>')
            .load($link.attr('href'))
            .dialog({
                autoOpen: false,
                title: $link.attr('title'),
                width: 500,
                height: 300
            });

        $link.click(function() {
            $dialog.dialog('open');

            return false;
        });
    });
});
  </script>

</head>
<body>
<a id="openwindow" href="http://www.google.com">Click me to test.</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我找到了一些例子,但没有一个真正奏效.我真的很感激一些帮助.

提前致谢.

html jquery jquery-ui jquery-ui-dialog

7
推荐指数
3
解决办法
6万
查看次数

为什么在String数组中添加Null字符?

我知道我们必须使用空字符来终止字符串数组,如下所示:

char str[5] = { 'A','N','S','\0' };
Run Code Online (Sandbox Code Playgroud)

但我只是想知道为什么使用空字符来终止这样的数组是必要的?

另外,为什么我们不添加null charater来终止这些: -

char str1[5]="ANS";
Run Code Online (Sandbox Code Playgroud)

c arrays string character-arrays

6
推荐指数
1
解决办法
2万
查看次数

Heroku 上 Django 的 SMTP 身份验证错误

我正在尝试使用 gmail smtp 服务器从我的 django 应用程序发送电子邮件。当我在本地服务器上运行应用程序时,正在发送电子邮件。但是我在 heroku 上使用它时遇到了 SMTP 身份验证错误。

追溯 -链接

设置.py -

# Email configuration.

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '***************@gmail.com'
EMAIL_HOST_PASSWORD = '************'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = '******************@gmail.com'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
Run Code Online (Sandbox Code Playgroud)

我重新检查了帐户密码,还启用了从我的 google 帐户访问安全性较低的应用程序。但我仍然收到此错误。

python email django smtp heroku

5
推荐指数
2
解决办法
3133
查看次数

如何以列表或元组的形式输入参数?

是否可以以列表的形式输入函数的参数.例如 -

list1 = ["somethin","some"]
def paths(list):
    import os
    path = os.path.join() #I want to enter the parameters of this function from the list1
    return path
Run Code Online (Sandbox Code Playgroud)

好的,我得到了我的答案,但只是一个附加问题,仅与此相关 - 这是我的代码 -

def files_check(file_name,sub_directories):
    """
        file_name :The file to check
        sub_directories :If the file is under any other sub directory other than the   application , this is a list.
    """
    appname = session.appname
    if sub_directories:
        path = os.path.join("applications",
                        appname,
                        *sub_directories,
                         file_name)
        return os.path.isfile(path)
    else:
         path = os.path.join("applications",
                        appname,
                        file_name)
         return os.path.isfile(path)
Run Code Online (Sandbox Code Playgroud)

我收到此错误 …

python parameters function list

3
推荐指数
1
解决办法
568
查看次数

在python 3中使用子进程

我正在使用子进程模块在python 3中运行shell命令.
这是我的代码

import subprocess
filename = "somename.py"  # in practical i'm using a real file, this is just for example
subprocess.call("pep8 %s" % filename, shell=True)) 
Run Code Online (Sandbox Code Playgroud)

不同文件的输出只是01.我是python 3的新手.在2.7中使用它给了我想要的输出,但在这里我无法弄明白.
这是我在python 2.7中获得的输出(对于名为 - 的文件anu.py) -

anu.py:2:1: W191 indentation contains tabs
anu.py:3:1: W191 indentation contains tabs
anu.py:3:7: E228 missing whitespace around modulo operator
anu.py:4:1: W191 indentation contains tabs
anu.py:5:1: W191 indentation contains tabs
anu.py:6:1: W191 indentation contains tabs
anu.py:7:1: W191 indentation contains tabs
anu.py:7:9: E231 missing whitespace …
Run Code Online (Sandbox Code Playgroud)

python subprocess python-3.x

2
推荐指数
1
解决办法
2064
查看次数

无法接受Google上的操作上的权限提示

我想获得的权限locationname我的应用程序.
这是我的index.js- 链接

它似乎陷入了一个循环: - 在此输入图像描述

以下是我对API.AI的意图: - 在此输入图像描述 在此输入图像描述

actions-on-google dialogflow-es

2
推荐指数
1
解决办法
463
查看次数

我可以在运行时使用python打开一个应用程序

我想知道我是否可以在运行时在Python中打开任何类型的应用程序?

python python-2.7 python-3.x

1
推荐指数
1
解决办法
3万
查看次数