All Caps

Post Reply
User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

All Caps

Post by Akaya »

Umm... I don't know how this is properly phrased but Is there a way to change a variable to all caps? From Akaya to AKAYA?
For example,
Someone says, "Banana."
Someone says, "(\w+)."
fruit = matches[2]

How can Banana become BANANA ?

Lezard
Posts: 36
Joined: Wed Aug 29, 2012 6:47 pm

Re: All Caps

Post by Lezard »

use string.upper()
Ex. fruit = string.upper(matches[2])

for other case formats, you can use string.lower() or string.title()
Last edited by Lezard on Mon Sep 03, 2012 8:10 pm, edited 1 time in total.

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: All Caps

Post by Akaya »

Awesome. Thanks a lot, Lezard!

Post Reply