18910140161

Telegraph API中的Python格式化列表-堆栈溢出

顺晟科技

2022-10-19 14:23:15

126

开发一个包括通过Python在电报上发布文章的系统。 一般情况下,一切都管用。但是最近我发现

      标记在不同的浏览器中有奇怪的行为。在移动版的电报上,它按预期工作,而其他地方却不是。除了硬编码行数之外,还有什么解决方案吗? 您可以在https://telegra.ph/arthur-conan-doyle-estudio-en-escarlata-1-09-06(截至2021年10月5日活跃)这里亲自查看。 我使用的代码如下:

      def update_page(path, title, content, author):
        response = telegraph.edit_page(path, html_content = content, title = title,
                                     author_name = author, return_content=True)
        current_path = 'http://telegra.ph/{}'.format(path)
        return current_path 
      
      html = '''
      <ol>
        <li>Coffee</li>
        <li>Tea</li>
        <li>Milk</li>
      </ol>
      <ul>
        <li>Coffee</li>
        <li>Tea</li>
        <li>Milk</li>
      </ul>
      '''
      title = 'Testing lists'
      update_page(test_path, title, html, AUTHOR)
      

      行为示例: 我需要的行为,移动版电报如下 我在Chrome、Firefox和Safari中得到的东西


      顺晟科技:

      尝试在一行中编写列表项,如

    • 1
    • 2
    • 3
    • 。这为我解决了问题。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航