My Python code looks like
name = 'my full name'
And i wanna print this texts be like
https://example.com/?s=my+full+name
So How can i remove space and put that '+'?
I want the example code and with explanation if possible.
My Python code looks like
name = 'my full name'
And i wanna print this texts be like
https://example.com/?s=my+full+name
So How can i remove space and put that '+'?
I want the example code and with explanation if possible.
Also you can write like this
name="my full name"
name1=[] #To store the string(modified)
for _ in range(len(name)):
if name[_]==' ': #condition
name1.remove(name[_-1])#removes the last appended element
name1.append(name[_-1]+"+")#appends concatenate last element with '+'
else:
name1.append(name[_])
print("".join(name1))