How to add prefix and suffix to a string in Python

2 Answers

0 votes
s = 'python'
 
s = 'X_' + s + '_Y'

print(s)
    
    
    
'''
run:
     
X_python_Y

'''

 



answered Feb 18, 2023 by avibootz
0 votes
s = 'python'
 
print(f"@{s}*")
    
    
    
'''
run:
     
@python*

'''

 



answered Feb 18, 2023 by avibootz
...