From the course: Grasshopper and Rhino: Python Scripting

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Strings

Strings

From the course: Grasshopper and Rhino: Python Scripting

Start my 1-month free trial

Strings

- [Narrator] Strings allow us to display and store information as letters and words. A string data type is essentially then text. It is made up of characters which form the complete string object. Let's have a look at creating strings within Python. Go ahead and place a new Python component onto the canvas and double click to open it up. We can create strings by first declaring a variable and assigning to it a value with either single or double quotation marks surrounding it. Let's try this by creating a variable word and we'll assign to this the string hello, using double quotation marks. We know this is now a string as it's turned up red. Let's go ahead and print the word variable. Perfect, so you can see that we've created our first string object. A string can be created using single or double quotation marks but never a combination. To try this let's update the hello string to have mismatched quotation marks and hit test, and you can see we get a syntax error, specifically the…

Contents