Jump to content

Substringing in Python 3.3

Go to solution Solved by Techicolors,

perhaps 

 

name = 'christopher'
print(name.replace("p", "P"))

>> christoPher

 

So i'm fairly new to python and i need to use sub stringing to change a letter in a name, i have a variable called "name" that = "christopher" and i need to change the "p" to an upper case "P". I have already tried to use the "variableName.split" command but that seems to make things very complicated so  does anyone know of a simpler method??? 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

perhaps 

 

name = 'christopher'
print(name.replace("p", "P"))

>> christoPher

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Technicolors said:

perhaps 

 


name = 'christopher'
print(name.replace("p", "P"))

>> christoPher

 

Thanks, it works :) 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×