Web_Development_and_Data_Analysis_Report
Web_Development_and_Data_Analysis_Report
app = Flask(__name__)
@app.route('/')
def home():
return "Welcome to Flask Web Development!"
@app.route('/greet/<name>')
def greet(name):
return f"Hello, {name}!"
Flask supports HTTP methods such as GET, POST, PUT, and DELETE. You can define
methods explicitly in a route.
- `request`: Access incoming request data such as form inputs, query parameters, headers,
and files.
- `response`: Customize the response sent to the client.
@app.route('/data', methods=['POST'])
def handle_data():
input_data = request.json # Expecting JSON data
response_data = {'message': 'Data received', 'input': input_data}
return jsonify(response_data)
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', title="Home Page")
if __name__ == '__main__':
app.run(debug=True)
Basic Example:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [10, 15, 7, 10, 12]
Conclusion
Python simplifies both web development and data analysis tasks. Using Flask, developers
can create dynamic web applications, while libraries like Matplotlib enable effective data
visualization. These tools combined empower developers to build data-driven web
applications with ease.