Python PRAW – Getting the ID of the submission that a comment belongs to in RedditReadDiscussCoursesPracticeImprove Article ImproveSave Article SaveLike Article LikeIn Reddit, we can post a comment to any submission, we can also comment on a comment to create a thread of comments. A comment is always posted on a submission. Here we will see how to fetch the ID of the submission that a comment belongs to using PRAW. We will be using the is_submitter attribute of the Comment class to fetch the ID of the submission that a comment belongs to.Example 1 : Consider the following comment :The ID of the comment is : fvib7aw# importing the moduleimport praw # initialize with appropriate valuesclient_id = ""client_secret = ""username = ""password = ""user_agent = "" # creating an authorized reddit instancereddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the ID of the commentcomment_id = "fvib7aw" # instantiating the Comment classcomment = reddit.comment(comment_id) # fetching the link_id attributelink_id = comment.link_id print("The submission ID of the comment is : " + link_id)Output : The submission ID of the comment is : t3_hczt0c Example 2 : Consider the following comment:The ID of the comment is : fv9qvgo# importing the moduleimport praw # initialize with appropriate valuesclient_id = ""client_secret = ""username = ""password = ""user_agent = "" # creating an authorized reddit instancereddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the ID of the commentcomment_id = "fv9qvgo" # instantiating the Comment classcomment = reddit.comment(comment_id) # fetching the link_id attributelink_id = comment.link_id print("The submission ID of the comment is : " + link_id)Output : The submission ID of the comment is : t3_hbjhnk Last Updated : 26 Jun, 2020Like Article Save Article Please Login to comment...Similar ReadsPython PRAW - Getting the subreddit ID that a comment belongs to in RedditPython PRAW - Checking whether a commenter is also the author of the submission in RedditPython PRAW - Getting the ID of a comment in RedditPython PRAW - Getting the body of a comment in RedditPython PRAW - Getting the time when a comment was posted on RedditPython PRAW - Getting the permalink of a comment in RedditPython PRAW - Getting the parent ID of a comment in RedditPython PRAW - Getting the score of a comment in RedditPython PRAW - Getting the subreddit on which a comment is posted in RedditPython PRAW - Getting the author of a comment in RedditRelated TutorialsPandas AI: The Generative AI Python LibraryOpenAI Python API - Complete GuidePython for Kids - Fun Tutorial to Learn Python ProgrammingData Analysis TutorialFlask Tutorial LikePreviousPython PRAW - Getting the parent ID of a comment in RedditNext Python PRAW - Checking whether a comment is stickied or not in RedditArticle Contributed By :YYash_RYash_R FollowVote for difficultyEasy Normal Medium Hard ExpertArticle Tags :Python-PRAWPythonPractice Tags :pythonReport Issue