-2

I want to get upper"T".. how to get upper string!

str = "Test Version"

print(str.upper())
print(str[3])
mustaccio
  • 18,234
  • 16
  • 48
  • 57

1 Answers1

0

It's not clear what you are asking.
But from context I am guessing you would like to make the second non-capitalised "t" in the string uppercase. I'm also going to assume you are using python 3 given your use of upper().

If you just want to get the "t" (and not change the string itself):
upper_T = str[3].upper()

If you want to create a string from the original you may be running into the fact that strings in python are immutable. You therefore must create a new string.

One way do this:

str2 = list(str)
str2[3] = str[3].upper()
str2 = ''.join(str2)
Aiden Ray
  • 369
  • 4
  • 14