我的笔记本中正在丢弃一些print()输出,但我看不到任何特定的模式或原因:
s = 'https://ad.doubleclick.net/'
t = 'ttps://ad.doubleclick.net/'
u = 'https://ad.doubleclick.net'
v = 'https://ad.doublclick.net/'
w = 'https://pubads.g.doubleclick.net/gampad/ads?caps'
for string in [s, t, u, v]:
print('str:', string)
print('repr(str):', repr(string))
print()
输出:
str:
repr(str): 'https://ad.doubleclick.net/'
str: ttps://ad.doubleclick.net/
repr(str): 'ttps://ad.doubleclick.net/'
str: https://ad.doubleclick.net
repr(str): 'https://ad.doubleclick.net'
str: https://ad.doublclick.net/
repr(str): 'https://ad.doublclick.net/'
str:
repr(str): 'https://pubads.g.doubleclick.net/gampad/ads?caps'
我的第一行和最后str:
行怎么了?
只发生在笔记本电脑上,在终端运行Python解释器不会有这个问题.
Python3.8.5
> which jupyter
/Library/Frameworks/Python.framework/Versions/3.8/bin/jupyter
> jupyter --version
Selected Jupyter core packages...
IPython : 8.0.0
ipykernel : 6.7.0
ipywidgets : 7.7.1
jupyter_client : 7.1.1
jupyter_core : 4.9.1
jupyter_server : not installed
jupyterlab : not installed
nbclient : 0.5.10
nbconvert : 6.4.0
nbformat : 5.1.3
notebook : 6.4.7
qtconsole : not installed
traitlets : 5.1.1