I'm a complete beginner. I know how to get things to print to the screen, with the print command. But I want to be able to input a string of text and have that text returned in all caps. Do I do this with an argument to the print command or with some kind of echo command or what?

Thanks

I'm a complete beginner. I know how to get things to print to the screen, with the print command. But I want to be able to input a string of text and have that text returned in all caps. Do I do this with an argument to the print command or with some kind of echo command or what?

Thanks

Hi kittensaretasty,

You can use the .upper() method to make all your text in a string uppercase. An example of this would be the following. >>> print 'hello world'.upper() With the result... HELLO WORLD There are many commands like this available in Python. I would recommend going through an online tutorial or reading a beginner Python book (what I am currently doing) to become more familiar with the syntax of the language.

Hope that helps!

That got the job done, yeah.

I'd tried to look through a few tutorials and the Python documentation but when I realized I wasn't sure whether it was part of the print command or echo or something else I got discouraged and thought I'd just ask.

Thanks for the help!

Don't be discouraged! The Python standard documentation is thorough, and there is much information out there for you.

In future if you're wondering if there's, say, a function to break a string up at every comma, you could try typing this in google:

string python

First result is your answer: http://docs.python.org/lib/string-methods.html

string manipulation python

Also not a bad answer: http://www.devshed.com/c/a/Python/String-Manipulation/

Here's a tutorial (actually a book which was uploaded by its author) which also covers a lot of the basic functions in Python's library: http://www.diveintopython.org/toc/index.html

Chances are if you think "wow I wish there was a basic function that could do this for me", there probably is.

Also: Die. Kittens are awesome.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.