Skip to content

Conversation

weilycoder
Copy link
Contributor

增加输出高维列表:

from cyaron import IO

table = [['#', 'S', '.', '.', '#'], ['#', '#', '#', '.', '#'],
         ['#', '.', '#', '.', '#'], ['#', 'T', '#', '.', '#'],
         ['#', '.', '.', '.', '#']]

f = IO('test.in', disable_output=True)
f.input_write_list(table, separator=['', '\n', ''])

运行后 test.in 文件中:

#S..#
###.#
#.#.#
#T#.#
#...#

或者,将 separator 改为 ['', '\n', ' ']

# S . . #
# # # . #
# . # . #
# T # . #
# . . . #

@weilycoder weilycoder mentioned this pull request Nov 20, 2024
@weilycoder
Copy link
Contributor Author

另外,separator 可以改为一个字符串,如将示例中的 separator 改为 ' '

# S . . # # # # . # # . # . # # T # . # # . . . #

@Mr-Python-in-China Mr-Python-in-China force-pushed the master branch 3 times, most recently from 2f520f5 to 7056a5a Compare June 30, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant