Autocomplete input suggestion using Python and Flask Last Updated : 09 Apr, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will learn how to give features like auto-completion to the data that is passed from Flask. Autocomplete basically means predicting the rest of the word when the user types something. This way human interaction also increases with every correct prediction. Let's see how to do the same. We will be using jquery for autocompletion. Installation : To install flask type the below command in the terminal. pip install flask First, create a new directory for the project. Inside that create a new file and name it app.py. app.py Python3 from flask import Flask, request, render_template app = Flask(__name__) @app.route("/", methods=["POST", "GET"]) def home(): if request.method == "GET": languages = ["C++", "Python", "PHP", "Java", "C", "Ruby", "R", "C#", "Dart", "Fortran", "Pascal", "Javascript"] return render_template("index.html", languages=languages) if __name__ == '__main__': app.run(debug=True) Then, create a new directory inside the project to hold all the HTML files and name them templates. In this file, we have an input field where the user will type a string and the jquery function will provide the suggestions. index.html HTML <!DOCTYPE html> <html> <head> <title>AutoComplete</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"> </script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"> </script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome to GFG</h1> <input type="text" id="tags"> <script> $( function() { var availableTags = [ {% for language in languages %} "{{language}}", {% endfor %} ]; $( "#tags" ).autocomplete({ source: availableTags }); } ); </script> </body> </html> To run this app open cmd or terminal and run the below command. python app.py Output: Comment More infoAdvertise with us Next Article Autocomplete input suggestion using Python and Flask V vivekpisal12345 Follow Improve Article Tags : Python Python Flask Practice Tags : python Similar Reads How to Build a Web App using Flask and SQLite in Python Flask is a lightweight Python web framework with minimal dependencies. It lets you build applications using Python libraries as needed. In this article, we'll create a Flask app that takes user input through a form and displays it on another page using SQLite.Run the following commands to install Fl 3 min read Todo list app using Flask | Python There are many frameworks that allow building your webpage using Python, like Django, flask, etc. Flask is a web application framework written in Python. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine. Its modules and libraries that help the developer to writ 3 min read Get similar words suggestion using Enchant in Python For the given user input, get similar words through Enchant module. Enchant is a module in python which is used to check the spelling of a word, gives suggestions to correct words. Also, gives antonym and synonym of words. It checks whether a word exists in dictionary or not. Other dictionaries can 1 min read Autocomplete ComboBox in Python-Tkinter Prerequisites: Python GUI â tkinter The Listbox widget is used to display a list of items from which a user can select a number of items. But have you ever wondered, how to return the list of possible results when a key is pressed? Let's see the following approach towards the same. Working of Progra 2 min read Build an AI Chatbot in Python using Cohere API A chatbot is a technology that is made to mimic human-user communication. It makes use of machine learning, natural language processing (NLP), and artificial intelligence (AI) techniques to comprehend and react in a conversational way to user inquiries or cues. In this article, we will be developing 5 min read Like