Menu¶
-
class
praw.models.Menu(reddit, _data)¶ Class to represent the top menu widget of a subreddit.
Menus can generally be found as the first item in a subreddit’s top bar.
topbar = reddit.subreddit('redditdev').widgets.topbar if len(topbar) > 0: probably_menu = topbar[0] assert isinstance(probably_menu, praw.models.Menu) for item in probably_menu: if isinstance(item, praw.models.Submenu): print(item.text) for child in item: print(child.text, child.url) else: # MenuLink print(item.text, item.url)
-
__contains__(item)¶ Test if item exists in the list.
-
__getitem__(index)¶ Return the item at position index in the list.
-
__iter__()¶ Return an iterator to the list.
-
__len__()¶ Return the number of items in the list.
-