from flask import Flask, render_template, request, redirect, session
import random
app = Flask(__name__)
app.secret_key = "guess_secret"
@app.route('/')
def landing_page():
if 'num' not in session:
session['num'] = random.randrange(0,101)
if 'message' not in session:
session['message'] = ''
if 'color' not in session:
session['color'] = ''
return render_template('indexa.html', msg = session['message'], color = session['color'])
@app.route('/execute', methods=['POST'])
def check_guess():
session(['guess']) = int(request.form['guess'])
if (session['guess']==session['num']):
session['message'] = str(session['num'])+'was the number!'
session['color']='green'
elif int(request.form['guess']) < session['num']:
session['message'] = 'Too low.'
session['color']='red'
else:
session['message'] = 'Too high.'
session['color']='red'
return redirect('/')
@app.route('/reset', methods=['POST'])
def reset():
session.pop('number')
session.pop('guess')
session.pop('color')
return redirect('/')
app.run(debug=True)
有一个选项git blame
,显示电子邮件但不再显示名称。有没有办法显示姓名和电子邮件?感谢。
答案 0 :(得分:1)
没有简单的方法。您可以解析git blame --line-porcelain
的输出,但这需要一些编程。