PYTHON90小菜鸟
发表于 2018-3-4 17:41:01
string = 'I love FishC.'
for i in string:
print(i+' ', end='')
_小菜鸟
发表于 2018-3-6 22:32:28
def newstr(string):
fresh = ''
for str_single in string:
if str_single != ' ':
fresh += (str_single + ' ')
else:
fresh += str_single
return fresh
if __name__ == '__main__':
str = 'I love Fishc.com'
print(newstr(str))
天下独我意
发表于 2018-6-16 14:21:36
>>> def op(n):
return ' '.join(list(n))
lkafw
发表于 2018-6-17 13:35:39
def f(s):
return ' '.join()
print(f('I love FishC.'))
print(f('跟小甲鱼学编程'))
foxiangzun
发表于 2019-1-18 20:23:18
def getSpaceIn(str) :
list1 = []
for i in str[:] :
list1.append(i)
list1.append(' ')
print(''.join(list1))
a = input('请输入一个句子或词组:')
getSpaceIn(a)
叼辣条闯世界
发表于 2020-11-22 17:35:42
def nb():
str1=input('请输入:')
nb()
print(' '.join(str1))
逆鳞丶樱之羽
发表于 2020-11-22 23:18:58
#萌新作法,勿喷。列表替换字符串
string = input('请输入一行字符串:')
change = []
for each in string:#去除原空格方便加空格
if each != ' ':
change.append(each)
for each in range(0,len(change)-1):
change.insert(2*each-1,' ')
couting = ''
for each in range(0,len(change)): #字符拼接
couting += change
print(couting)