python programming data model part 1
#python #pythonprogramming #pythontutorial #pythonforbeginners #learning #learntocode #coding #codingforbeginners #codingforkidsfree
yes hello everyone so today we will take a look to how to uh use named Tuple in Python
so some Theory button name Tuple namedtuple is a pythonic way of creating classes for the objects so we'll see in a minute how this can be done
so let's use our print hi function it's a template from the pycharm when you create a new project so I'm going to import
collections
collection start name Tuple the namedtuple is a function on the collections
in the collection package, so now you see the name Tuple I can give so let's take a look at its documentation
it says you have to provide a type name which is a string and the field names string
for example, we want to create a type person and we want to give it to
name as it's attribute h another and country
this will create our person class, for instance
now you can use this person close
theater person
what you all have to do is provide this name for example I'm giving my own name it's h which is for now string so I give it five then we provide this country Singapore
this is done so would like to see how does the person comes up when we don't want to print it
yeah you can see that person class object is created once we print it and it has all its properties so
this is the concepts from the python data model how you can create the models data models so this is a data model which holds the data and the model is the person
how you can create data models using Python's framework so this is the power of Python's framework where you say collections dot named Tuple call its function internally it creates a class on the Fly the named person and assign it following attributes when you provide the values it instantiate the object one interesting thing you can do is to try to print type
of the purse
again run it says class in the main person
thank you for now and I hope you enjoyed the video and I hope this was useful for you thank you very much
To learn more, please subscribe to my channel.
Checkout my website for more courses:
https://deepdivesg.com/index.html
https://deepdivesg.com/course-details-ltc.html
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «python programming data model part 1», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.