Python print How to wrap the output?
Using the print function in Python, you can add the "\n" newline character to the output content to achieve newline output. "\n" is a computer language expression, and its function is to jump to For a new line, if you want to wrap it in a Windows system, you need to add "\r" at the end of "\n".
Sample code
class PrintTable(object): def __init__(self): print('开始打印 9X9 乘法表格') self.print99() def print99(self): for i in xrange(1, 10): for j in xrange(1, i+1): print('%d * %d =%2s ' %(j,i,i*j)), print('\n') if __name__ == '__main__': pt = PrintTable()
Other escape characters
Recommended tutorial: "Python Tutorial"
The above is the detailed content of How to wrap the output in Python print?. For more information, please follow other related articles on the PHP Chinese website!