Static Code Analysis
- Ensure the following extensions are installed
- pylint | flake8 | mypy

- autopep8 | black formatter

- Refer Here for changes done to improve code quality
Property (oops)
class Person:
def __init__(self, name):
self._name = name
@property
def name(self):
return self._name
@name.setter
def name(self, value):
if not isinstance(value, str):
raise TypeError('Name must be a string')
self._name = value
p = Person("test")
p.name = "hello"
Persistence
- To add persistence to our applications we have two approaches
- unstructured:
- data cannot be queried can only be searched
- examples:
- decision: file format
- structured:
- data can be queried
- Examples:
- decision: database type
Findout What is the file format & when to use
number, name, course
1, abc, python
2, abd, DevOps
3, abe, GenAI
{
"course": "Python",
"students": [
"abc", "bca"
],
"address": {
"flatno": 601,
"building": "nigiri"
}
}
---
course: Python
students:
- abc
- bca
address:
flatno: 601
building: nilgiri
Reading and Writing files in Python
- Refer Here for python file handling
- Lets write a dictionary into json
- Refer Here for the examples done in the class
Like this:
Like Loading...