Python3 编码类中存在空格问题

问题描述 投票:0回答:1

我输出了正确的代码,但我在最后一个冒号后面的空格以及“休斯顿和德克萨斯”之间犯了错误

I am outputting the right code, but I am making a mistake in the whitespace after the last colon, and also between

尝试输出图中给出的输出。继续获取有关我的空格有何不同的错误代码。我知道我缺少的东西很简单。

python python-3.x string class whitespace
1个回答
0
投票

除了上面的评论(这对于初学者来说有点高级)之外,最简单的解决方案是自己添加空格:

所以改变:

log_entry= current_time + my_city + my_state

至:

log_entry= current_time + " " + my_city + " " + my_state

代替

" "
,您还可以使用单引号
' '

© www.soinside.com 2019 - 2024. All rights reserved.