不妨考虑对字符串中的单引号进行转义
print('s=\'\'\'<li><a href="http://news.sina.com.cn/o/2022-2-23/a75.shtml" ',file=txt)