安慰#
介绍#
The IQ (2nd gen) Console appears in the Monitor window and displays text output from your project. In other environments like VS Code, print
will display text on the terminal. New projects begin with the cursor at row 1.
以下是所有可用方法的列表:
操作 – 与打印控制台交互。
行动#
print#
print
prints text in the console using the current cursor position.
Usage:
print(string, end)
参数 |
描述 |
---|---|
细绳 |
将作为字符串打印的文本。 |
结尾 |
Optional. The string added to the end of the printed text. Specified as |
# Display two messages consecutively
print("I'm printed on one line.")
print("I'm printed automatically on the next line!")
# Print three colors on one line in the Print Console
colors = ["Red", "Green", "Blue"]
for color in colors:
print(color, end=", ")
Clear Print Console#
By using \033[2J
inside of the print
command, you can clear the entire Print Console. This will also set the cursor back to row 1.
# Print to the console, then clear it after
# 2 seconds
print("VEXcode")
wait(2, SECONDS)
print("\033[2J")