【问题标题】:read html file with python at Zapier在 Zapier 用 python 读取 html 文件
【发布时间】:2021-07-18 05:49:27
【问题描述】:

我正在尝试使用 Zapier 中的 Python 代码读取 html 文件的内容。

输入数据:

with open('name') as f:
contents = f.read()
print(contents)

我正在尽力从其他教程中复制和粘贴,但我似乎无法得到它。

【问题讨论】:

  • 您是否遇到错误?呈现的代码将引发IndentationError

标签: python zapier


【解决方案1】:

如果您尝试从其他目录读取文件并且遇到问题,请尝试使用以下方法。 检查下面的代码以获得您的想法

import os
os.chdir('c:\mypath') # add your path here
with open("name.html", 'r', encoding='utf-8') as f:
    contents = f.read()
    print(contents)

它应该在控制台上为您提供以下输出

【讨论】:

    猜你喜欢
    • 2018-01-06
    • 2018-02-03
    • 1970-01-01
    • 2018-02-11
    • 2022-01-13
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 2019-07-31
    相关资源
    最近更新 更多