python3 remove space from print

前端 未结 3 1192
渐次进展
渐次进展 2021-01-26 17:40

I\'ve got some simple python loop through a name to create a list of devices:

for i in range(18):
print(\"sfo-router\",(i))

The problem is it p

3条回答
  •  再見小時候
    2021-01-26 17:55

    I'm new at python as well, and a quick google search did this one:

    Just use str.replace():

    string = 'hey man'
    string.replace(" ","")
    # String is now 'heyman'
    

    Source: Python remove all whitespace in a string

提交回复
热议问题