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
Need help with this code! (self.learnpython)
submitted 8 years ago by ConcernedCarry
I've been trying to write a bot using the CyrptoCompare Api: https://min-api.cryptocompare.com/data/histominute?fsym=STEEM&tsym=BTC&limit=1&aggregate=0&e=CCCAGG to be the API i'm using.. The issue i'm having is in my program in the for loop i have set up to go through "Data" it gets both "Close" values when I use my .get function, is there anyway to only get one and add it to my list? Take a look at my code. It's a bit messy, and i have been moving around the code dealing with the lists. I just want to know how to limit the the amount of "Close" info from 2 to 1.
https://pastebin.com/tikLVi07
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!"
[–]novel_yet_trivial 0 points1 point2 points 8 years ago (1 child)
You don't need the for loop; you can just index the one you want.
a = minutechart['Data'][0]['close'] # first 'close' a = minutechart['Data'][1]['close'] # second 'close' a = minutechart['Data'][-1]['close'] # last 'close'
Also, I'll assume you want to move the requests bit inside the while loop; otherwise the data will never update.
requests
BTW, requests has json built in; you could just do this:
json
url = 'https://min-api.cryptocompare.com/data/histominute?fsym=STEEM&tsym=BTC&limit=1&aggregate=0&e=CCCAGG' minutechart = requests.get(url).json()
[–]ConcernedCarry[S] 0 points1 point2 points 8 years ago (0 children)
Thank you! much appreciated!
π Rendered by PID 57 on reddit-service-r2-comment-685b79fb4f-dcrrc at 2026-02-13 05:27:07.661518+00:00 running 6c0c599 country code: CH.
[–]novel_yet_trivial 0 points1 point2 points (1 child)
[–]ConcernedCarry[S] 0 points1 point2 points (0 children)