推荐学习书目
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 · Jan 6, 2019 · 2187 views
    This topic created in 2711 days ago, the information mentioned may be changed or developed.
    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 replies    2019-01-15 00:02:26 +08:00
    songdg
        1
    songdg  
    OP
       Jan 8, 2019
    或者有没有其他的方法?
    necomancer
        2
    necomancer  
       Jan 11, 2019 via Android   ❤️ 1
    没试过。但新版 numpy 可以使用 file handler,
    o=open("a.txt","w")
    o.write("\t")
    np.savetxt(o,......)
    songdg
        3
    songdg  
    OP
       Jan 15, 2019
    @necomancer 谢谢帮助。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3427 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 11:20 · PVG 19:20 · LAX 04:20 · JFK 07:20
    ♥ Do have faith in what you're doing.