小编use*_*ame的帖子

如何将Python StringIO()对象传递给ZipFile(),还是不受支持?

所以我有一个StringIO()类似文件的对象,我正在尝试将其写入a ZipFile(),但是我得到了这个TypeError:

coercing to Unicode: need string or buffer, cStringIO.StringI found
Run Code Online (Sandbox Code Playgroud)

以下是我正在使用的代码示例:

file_like = StringIO()
archive = zipfile.ZipFile(file_like, 'w', zipfile.ZIP_DEFLATED)

# my_file is a StringIO object returned by a remote file storage server.
archive.write(my_file)
Run Code Online (Sandbox Code Playgroud)

文档说这StringIO()是一个类文件类,ZipFile()可以接受类文件对象.有什么我想念的吗?任何帮助将不胜感激.

提前致谢!

python zipfile stringio

11
推荐指数
1
解决办法
6809
查看次数

不同行的不同边框间距

概要:我需要显示如下表格:

桌子与头部和身体之间的间距不同

必要性:

  • 语义HTML编码
  • 没有脚本

HTML:

<table>
<thead>
    <tr>
        <th colspan=2>
            One
        </th>
        <th colspan=2>
            Two
        </th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>
            One
        </td>
        <td>
            Two
        </td>
        <td>
            Three
        </td>
        <td>
            Four
        </td>
    </tr>
    <tr>
        <td>
            One
        </td>
        <td>
            Two
        </td>
        <td>
            Three
        </td>
        <td>
            Four
        </td>
    </tr>
<tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

第一次尝试:

"border-collapse属性"

我试图border-collapse: separate;theadborder-collapse: collapse;tbody但根本不起作用.

table {
    border-collapse: collapse;
    border-spacing: 1em;
}

table thead {
    border-collapse: separate;
}

table tbody tr { …
Run Code Online (Sandbox Code Playgroud)

css html5 html-table semantic-markup css3

3
推荐指数
1
解决办法
6832
查看次数

标签 统计

css ×1

css3 ×1

html-table ×1

html5 ×1

python ×1

semantic-markup ×1

stringio ×1

zipfile ×1