【发布时间】:2021-06-13 03:34:37
【问题描述】:
我正在尝试制作一个脚本来告诉用户他们在游戏中的中断位置(例如:阁楼、地下室等)。问题是我试图让所有这些都打印在同一行,但句子末尾的句点打印在不同的行上。
这里是代码
f = open(cd+"/Data/currentGame", "r")
l = open(cd+"/Data/currentLocation", "r")
current_game = f.read()
current_location_lines = l.readlines()
current_location = current_location_lines[0]
f.close()
l.close()
print("You have an existing game where you left off in "+str(current_location)+".")
问题是它输出了这个:
You have an existing game where you left off in the attic
.
(句号在不同的行。)
【问题讨论】:
标签: python python-3.x printing