Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ReGex With Python
#31
Look at the source there is a list,as posted use [0] to get in.
['nodes'][0]['text']
Reply
#32
(Oct-22-2016, 05:58 PM)snippsat Wrote: Look at the source there is a list,as posted use [0] to get in.
['nodes'][0]['text']

Oh, i will try this:
    try:
        while count <= len(data['entry_data']['PostPage'][0]['media']['comments']['nodes'][count]['text']):
            try:
                print(data['entry_data']['PostPage'][0]['media']['comments']['nodes'][count]['text'])
                count = count + 1
            except:
                pass
    except:
        pass
Output:
All comments  **biggrin**
But, my question, If I do not put the try, I get an error, there may be a problem in the future?

Reply
#33
(Oct-22-2016, 05:58 PM)snippsat Wrote: Look at the source there is a list,as posted use [0] to get in.
['nodes'][0]['text']

Snippsat, i want to thank you very much for your help. Can I collaborate with the forum answering questions?.

Thanks again!.  Big Grin
Reply
#34
Quote:Can I collaborate with the forum answering questions?

Sure, that is what the forum is for  Smile .
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020