Skip to content

Commit

Permalink
Use __main__
Browse files Browse the repository at this point in the history
  • Loading branch information
sanxiyn committed May 14, 2023
1 parent 5aba968 commit 5f09151
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lobsters/search.py
@@ -1,3 +1,5 @@
import argparse

import lxml.html
import requests

Expand All @@ -12,9 +14,9 @@ def search(topic):
text = item.text_content()
print(f' * {text}')

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('topic')
args = parser.parse_args()

search(args.topic)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('topic')
args = parser.parse_args()
topic = args.topic
search(topic)

0 comments on commit 5f09151

Please sign in to comment.