完善这个函数
太棒了!您已经看到 f-string 的高效与便捷,因此打算重构更多旧代码。
现在您知道,f-string 可以在字符串中直接求值表达式,并包含函数与方法调用。您决定在一个项目中使用它:分析 120 条推文,检查是否包含不同新闻的链接。这样代码会更简洁、更易读。
变量 number1、number2、string1 和 list_links 已预先加载。
如果想查看这些变量,您可以在 IPython Shell 中使用 print()。
本练习是课程的一部分
Python 中的正则表达式
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Include both variables and the result of dividing them
print(f"___ tweets were downloaded in ____ minutes indicating a speed of ____ tweets per min")