Text files are very versatile and can be formatted in lots of different ways. That's why we sometimes call them unstructured data. There's little or no predefined structure to a text file. In contrast, a spreadsheet has a well-defined formatting or well-defined structure with data aligned neatly in rows and columns. This kind of data, which looks like a table with rows and columns, is called structured data. Structured data, like a spreadsheet, is processed a bit differently in Python than unstructured data like text. You can often use Python code to process it directly, even without using an AI language model. For example, if you've been saving information for each destination for your dream vacation in a spreadsheet with one of the columns specifying the country, you could then use Python to help you filter by location and see all the stops in a particular country like Japan. Let's take a look how to do all of this. In this lesson, we're going to use an example of processing an itinerary that looks like this. In this table, each row corresponds to a destination with the arrival and departure dates. And if you were to take this table and express it in a CSV file, it might look like this, where each row has commas separating the four values corresponding to the four columns of this table. So if you have a CSV file like this on your computer, you can load this data into Python. So let me import a few functions as before. And the new command here is import csv. My itinerary is saved in a file itinerary dot csv. And so this will open up that file. Next here is the code that will load the data into the itinerary variable. We'll go over in detail what each of these lines does. But if I just run this for now, you end up with this. And so this is loading "itenerary.csv one row at a time. And saving it in this this itinerary. Let me close the file before I forget. If I print itinerary, then you see this. If you want you can confirm the type of itinerary is a list. If you look at itineraries. Item zero. This is itself a dictionary with keys arrival, departure, city, country and so in fact i will use itinerary zero and then access the country. I end up with USA. Now you might be wondering what this code does. I encourage you to go ahead and try the chatbot and read over the explanation and see if it makes sense to you. But we'll go over everything together. Here's the code we just use to read itinerary dot csv. This first line opens the file in reading mode, and this is a code that reads the file contents and assigns them to the itinerary variable. And then that closes the file. Let's dig into what this middle portion of the code does. The first line, CSV reader equals CSV dot dict reader f, use this CSV which we had imported, this will use a dictionary to store the data in each row. Next, itinerary starts off as an empty list and then finally, this iterates over each row in the CSV file and adds to the end of the itinerary lists the contents of that row. Now print itinerary came out with this, which is a little bit hard to read. And that's how we've also provided the display table, which we had imported. That prints out the table in the nicer-looking way. Is that nice? Now with structured data, that is data in a table like this, that is often more feasible to filter information even without using an AI language model. For instance, if you want to get all the destinations are located in Japan, here's what you could do. Let me start with filtered data equals an empty list. And now let's filter by country. I'm going to say for trip, stop in itinerary. So this will go through the itinerary and trip stop and turn would be set to each row. So it'll be a dictionary. If trip stop country equals Japan then filtered data dot append trip stop. So I'm saying go through all of the rows in the itinerary. And if the country is Japan, then append that stop to filter data. And if I do that and then say display table filtered data, they end up with that one stop that corresponds to Japan. Now let's use the itinerary to suggest trip activities. Let's retrieve the first destination, which is New York City in the USA. So I set trip stop equals itinerary zero. This, remember, zero corresponds to the first entry in a list. And that's a stop in New York in USA. Now let's store all the key data for that stop in four new variable city country arrival and departure. And just as a reminder, this is a code for accessing a specific key in a dictionary. I'm then going to create an LLM prompt that says I'll visit city, country for arrivals, departures please share a detailed data itinerary. And let's get the response for the LLM and display it. And this creates a you know, pretty fun itinerary. July 4th in the United States is the US Independence Day. So it is recommending going to the 4th of July fireworks. I encourage you after this video to try out your own variations. Once you pick a different city, as you even get a fun itinerary. So I hope you have fun thinking about potential vacations. And when you're done playing with this notebook. I look forward to seeing you in the next lesson. Well, you see how to define your own functions. You've seen that there's some lines of code that we end up writing over and over. For example, to open the file, read the text from that file, and then close that file and you see in the next lesson how to find a function. Let's you run sets of commands without having to write them over and over again. In a way that's more flexible than a for loop. Look forward to seeing you in the next lesson.