python flask print to console

 因為在使用flask開發時,總是會有除錯的時候,所以需要把一些訊息print出來。

在python 2的版本,可以使用下列的方式:

from __future__ import print_function

import sys

print('This is test1', file=sys.stderr)

print('This is test2', file=sys.stdout)


而在python 3的版本下,已經不需要print_function,改為如下:

import sys

print('This is test1', file=sys.stderr)

print('This is test2', file=sys.stdout)

Windows 11安裝時跳過網路連線