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 年 1 月 6 日 · 1990 次点击
    这是一个创建于 2580 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 年 1 月 8 日
    或者有没有其他的方法?
    necomancer
        2
    necomancer  
       2019 年 1 月 11 日 via Android   ❤️ 1
    没试过。但新版 numpy 可以使用 file handler,
    o=open("a.txt","w")
    o.write("\t")
    np.savetxt(o,......)
    songdg
        3
    songdg  
    OP
       2019 年 1 月 15 日
    @necomancer 谢谢帮助。
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   919 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:06 · PVG 05:06 · LAX 13:06 · JFK 16:06
    ♥ Do have faith in what you're doing.