filmov
tv
Python Demo: Making a List of Data-Class Objects From CSV File
![preview_player](https://i.ytimg.com/vi/iKKU5c9ielw/sddefault.jpg)
Показать описание
In this video we look at Python code that uses the dataclass module to establish a template for making objects corresponding to Hockey Players. The code demonstrates both instance and static methods. It uses the re (regular expression) module to eliminate undesired characters -- using sub() -- and parse some data into parts -- using split(). The class add the code
if __name__ == "__main__"
to determine if the user is attempting to run the class code. A separate file imports the above class as well as the re and csv modules. It reads and parses a csv data file containing data on a roster of Hockey Players.
if __name__ == "__main__"
to determine if the user is attempting to run the class code. A separate file imports the above class as well as the re and csv modules. It reads and parses a csv data file containing data on a roster of Hockey Players.