Hey everyone! I'm just a beginner in programming and Python, and I've created a simple web scraping script. My script prompts the user for a hockey player's name, constructs a URL to scrape their stats from the hockey-reference website, and then prints out those stats. I'm worried that I'm doing things wrong or inefficiently. I'd love to get your feedback on my code and any suggestions for improvement! I learned everything from online guides and documentation, so if I'm missing something, that's my excuse. Thanks!
3 Answers
You might want to take a look at the code duplication you've included; it seems like you've posted the same code twice. Also, using a prompt for input is cool, but consider looking into `sys.argv` or libraries like `argparse` to get input more efficiently. It could streamline the process instead of looping for player names directly!
Your approach works, but instead of using a loop, have you considered pulling the player's name from the command line arguments? It might simplify things and reduce the need for unnecessary prompts.
Oh, I've never used `sys.argv`! Sounds useful, I'll look into it. Thanks!
Your code actually works fine! Don't worry too much about feeling unsure; everyone starts somewhere. Just keep experimenting and learning from your mistakes. It seems functional to me! 91e3fc91e3fc
Haha, I didn't realize I posted it twice! I'll check out `sys.argv` as well; thanks for the tip!