V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
songdg
V2EX  ›  Python

numpy.savetxt 如何将首行也缩进一个 table

  •  
  •   songdg · 2019-01-06 16:38:27 +08:00 · 1524 次点击
    这是一个创建于 1908 天前的主题,其中的信息可能已经有所发展或是发生改变。
    A = np.array([[930,1568,33],[945,1566,58],[1000,1599,88]])
    np.savetxt('test.txt', A, fmt='%.6s', header='', newline='\n\t',delimiter='\t\t')
    newline='\n\t'可以将第二行及以后都缩进一个 table 那么第一行的怎么办?
    3 条回复    2019-01-15 00:02:26 +08:00
    songdg
        1
    songdg  
    OP
       2019-01-08 10:45:49 +08:00
    或者有没有其他的方法?
    necomancer
        2
    necomancer  
       2019-01-11 19:48:16 +08:00 via Android   ❤️ 1
    没试过。但新版 numpy 可以使用 file handler,
    o=open("a.txt","w")
    o.write("\t")
    np.savetxt(o,......)
    songdg
        3
    songdg  
    OP
       2019-01-15 00:02:26 +08:00
    @necomancer 谢谢帮助。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3233 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 12:16 · PVG 20:16 · LAX 05:16 · JFK 08:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.