SyntaxError:语法无效。 [英] SyntaxError: Invalid Syntax.

查看:135
本文介绍了SyntaxError:语法无效。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论我在哪里放置这个导入的文件,它在

之后的语句主程序都会出现语法错误,无论语法如何。


我想我可能在这个文件中有所改变,但我被困住了。可以

任何人都可以帮忙吗?


#!/ usr / local / bin / python

#Copyright 2004 by Stephen Masterman


#更改数据库连接详细信息。

导入MySQLdb


def connect():

return = MySQLdb.connect(host =" db91x.xxxx.com",

user =" xxxx",

passwd =" ; xxxxx",

db =" homebase_zingers"

);

no matter where I place this imported file,the statement after it in
the main program gets a syntax error, regardless of the syntax.

I think I may have changed something in this file, but I''m stuck. Can
anyone help?

#!/usr/local/bin/python
# Copyright 2004 by Stephen Masterman

#Change the db connection details here.
import MySQLdb


def connect():
return = MySQLdb.connect (host = "db91x.xxxx.com",
user = "xxxx",
passwd = "xxxxx",
db = "homebase_zingers"
);

推荐答案

ronrsr写道:
ronrsr wrote:

return = MySQLdb.connect(host =" db91x.xxxx.com",

user =" ; xxxx",

passwd =" xxxxx",

db =" homebase_zingers"
);
return = MySQLdb.connect (host = "db91x.xxxx.com",
user = "xxxx",
passwd = "xxxxx",
db = "homebase_zingers"
);



return是保留关键字。您不能拥有该名称的变量。


-

Roberto Bonvallet

return is a reserved keyword. You cannot have a variable with that name.

--
Roberto Bonvallet


here'来自主程序的一些周围代码:


querystring = querystring +" ORDER BY关键字" ;;

#SQL

import zsql


zc = zsql.connect()


打印(从打开返回)


zq = zc.query(查询字符串).dictresult()


ronrsr写道:
here''s some of the surrounding code from the main program:

querystring = querystring + " ORDER BY keywords ";
#SQL
import zsql

zc = zsql.connect()

print("return from open")

zq = zc.query(querystring).dictresult()

ronrsr wrote:

无论我在哪里放置这个导入的文件,后面的语句在

主程序得到语法错误,无论语法如何。


我想我可能在这个文件中改变了一些东西,但是我被卡住了。可以

任何人都可以帮忙吗?


#!/ usr / local / bin / python

#Copyright 2004 by Stephen Masterman


#更改数据库连接详细信息。


导入MySQLdb


def connect ():


return = MySQLdb.connect(host =" db91x.xxxx.com",

user =" xxxx",

passwd =" xxxxx",

db =" homebase_zingers"
);
no matter where I place this imported file,the statement after it in
the main program gets a syntax error, regardless of the syntax.

I think I may have changed something in this file, but I''m stuck. Can
anyone help?

#!/usr/local/bin/python
# Copyright 2004 by Stephen Masterman

#Change the db connection details here.
import MySQLdb


def connect():
return = MySQLdb.connect (host = "db91x.xxxx.com",
user = "xxxx",
passwd = "xxxxx",
db = "homebase_zingers"
);


在< 11 ********************* @ k70g2000cwa.googlegroups中。 com>,ronrsr写道:
In <11*********************@k70g2000cwa.googlegroups. com>, ronrsr wrote:

def connect():


return = MySQLdb.connect(host =" db91x .xxxx.com",
def connect():
return = MySQLdb.connect (host = "db91x.xxxx.com",



^


你不能指定一个关键字。只需留下这个`` =``out。


Ciao,

Marc''BlackJack''Rintsch

^

You can''t assign to a keyword. Just leave this ``=`` out.

Ciao,
Marc ''BlackJack'' Rintsch


这篇关于SyntaxError:语法无效。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆