Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix savetxt comments default value
  • Loading branch information
v923z committed Jan 31, 2022
commit 9ba136acd43c9f504865c3b08a5e39394ceb83bc
4 changes: 2 additions & 2 deletions code/numpy/io/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ static mp_obj_t io_savetxt(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw
const char *comments = mp_obj_str_get_data(args[5].u_obj, &_len);
stream_p->write(stream, comments, _len, &error);
} else {
stream_p->write(stream, "#", 1, &error);
stream_p->write(stream, "# ", 2, &error);
}
const char *header = mp_obj_str_get_data(args[3].u_obj, &_len);
stream_p->write(stream, header, _len, &error);
Expand Down Expand Up @@ -799,7 +799,7 @@ static mp_obj_t io_savetxt(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw
const char *comments = mp_obj_str_get_data(args[5].u_obj, &_len);
stream_p->write(stream, comments, _len, &error);
} else {
stream_p->write(stream, "#", 1, &error);
stream_p->write(stream, "# ", 2, &error);
}
const char *footer = mp_obj_str_get_data(args[4].u_obj, &_len);
stream_p->write(stream, footer, _len, &error);
Expand Down
4 changes: 2 additions & 2 deletions tests/2d/numpy/savetxt.py.exp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ savetxt with delimiter
6.000000000000000,7.000000000000000,8.000000000000000

savetxt with header
#column1 column2 column3
# column1 column2 column3
0.000000000000000 1.000000000000000 2.000000000000000
3.000000000000000 4.000000000000000 5.000000000000000
6.000000000000000 7.000000000000000 8.000000000000000
Expand All @@ -29,5 +29,5 @@ savetxt with footer
0.000000000000000 1.000000000000000 2.000000000000000
3.000000000000000 4.000000000000000 5.000000000000000
6.000000000000000 7.000000000000000 8.000000000000000
#written data file
# written data file