亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python嘗試除了最后無效的語法錯誤

Python嘗試除了最后無效的語法錯誤

白衣非少年 2021-08-14 16:03:18
所以我試圖在 python 中使用這個異常處理。為此,我正在使用 python2.7 和燒瓶。另外,我對 python 和燒瓶都很陌生,所以我一定在這里做錯了。if test:    cursor = conn.cursor()    try:        print cursor.execute("INSERT INTO Users (email, password, firstname, lastname, home, gender, dob, bio, profile_Image) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}')".format(email, password, firstname, lastname, home, gender, dob, bio, photo_data))        conn.commit()        #log user in        user = User()        user.id = email        flask_login.login_user(user)        uid = getUserIdFromEmail(flask_login.current_user.id)        today = str(date.today())        print today    except Exception as e:        print e        print "Something Went wrong"        return flask.redirect(flask.url_for('register'))    print cursor.execute("INSERT INTO Album (uid, aname, adate, cover) VALUES ('{0}', 'default', '{1}', '{2}')".format(uid, today, photo_data))    aid = getAIDfromAname('default', uid)    cursor.execute("INSERT INTO Photo (uid, aid, data, caption) VALUES ('{0}', '{1}', '{2}', 'profile')".format(uid,aid,photo_data))    cursor.execute("INSERT INTO Scoreboard (uid) VALUES ('{0}')".format(uid))    conn.commit()    finally:        cursor.close()    return render_template('profile.html', firstname=firstname, message='Account Created!')else:    print "couldn't find all tokens"    return render_template('register.html', message='Email Already Exists')然后如果我運行該應用程序,它會給我這個錯誤  File "app.py", line 540finally:      ^SyntaxError: invalid syntax我想知道為什么它給我錯誤:/
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 149 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號