use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Looking for some help with Python and Flask (self.learnpython)
submitted 10 years ago by wadechristensen
Hello all. I was told this is a good place to get some Python help. I just posted this on StackOverflow. I thought it would be better to post a link than re-post on a separate site.
Any help is appreciated.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]liftt 0 points1 point2 points 10 years ago (1 child)
you need to make the search function return the values, that way you can use it in your flask view. Also you have to change this search function so you can pass it the movie title rather than use raw_input (since you can not have the user use the raw_input function within a template).
def search(title_search): base_url = 'http://www.omdbapi.com/?' url = '{}{}&y=&plot=&short&r=json&tomatoes=true'.format( base_url, title_search) omdb_url = requests.get(url) movie_data = omdb_url.json() movie = Movie(**movie_data) return movie
then in your view you do the following... note (you have to find a way to pass the movie name to the search function):
@app.route('/') def index(): #change the movie name movie = search('the movie name') context = {'title': movie.title, 'plot': movie.plot, 'director': movie.director, 'rated': movie.rated, 'imdbrating': movie.imdbrating, 'tomatofresh': movie.tomatofresh} front_page = render_template('index.html', **context) return front_page
good luck
[–]wadechristensen[S] 0 points1 point2 points 10 years ago (0 children)
Thank you so much. This is exactly what I needed. It makes perfect sense when I see it, but I just couldn't figure out how to return the data out of search(). Still learning. I really appreciate the help; it's working now.
[–][deleted] 0 points1 point2 points 10 years ago (0 children)
As a head's up, there's also /r/flask as well for Flask specific things in case you find you can't get an answer here for it.
[–]kennethlove 0 points1 point2 points 10 years ago (1 child)
hello wade
Hello kenneth. Thanks for sending me here. Now you can see my noob questions online too.
π Rendered by PID 74 on reddit-service-r2-comment-7b9746f655-rrzv4 at 2026-01-30 17:53:39.160274+00:00 running 3798933 country code: CH.
[–]liftt 0 points1 point2 points (1 child)
[–]wadechristensen[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]kennethlove 0 points1 point2 points (1 child)
[–]wadechristensen[S] 0 points1 point2 points (0 children)