Python Project: Properties Maintenance System P7
Subject: Writing a Full Application for Properties Maintenance System [Property: Showing the Records in Main property Table]
Learning : Python, Math, SQL, Logeic
[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]
After adding Records to the Main Property Table, we need to display the records on the screen. So now in this part (Part -7) we will write a function to display all the records. The Function name will be def show_property() the function is not taking any attribute and is Not returning any things. First we will print-out the Table-Header then we will run an [SQL: select * from table-name] command to fetch all the records, then will [for loop] and test-format to print all the records on the screen. Here is the Code ..
![]() |
After i display the records, I notes that the Address-Column needs more than one row (in some cases), and it miss the line formating, so I wrote a function and call it def warp_text(tex,warp_on,nl_space) the function takes three arguments, the test: it the text/string you want to print.warp_on: is a number of character before the new-line.nl_space: is the number of white-character in the new-line.
Here is the Code ..
# Function to warp def warp_text(tex,worp_on,nl_space) : c = 0 for t in range (len(tex)) : print(tex[t],end="") c += 1 if c == worp_on : print('\n', ' '*nl_space, end="") c = 0
Check all the codes in the Download Page..
End of Part 7
NOTE: If you Download this Part you MUST Run the Option 82 (82. Delete the Data-Base and Start Again.) from the Main Menu to do the following Updates:
- Update the properties_t Table (Adding the number of BathRooms)
- Update on create_tables Function.
- Update on insert_zero_records Function.
If you did this in last part (6) then you don’t need to do it again
In Part-8 In the Next Part, after adding and showing the records we will write the Function to Delete a record from the Table.
:: PMS Parts ::
Part 1 | Part 2 | Part 3 | Part 4 |
Part 5 | Part 6 | Part 7 | Part 8 |
..:: Have Fun with Coding ::.. 🙂
To Download my Python code (.py) files Click-Here
By: Ali Radwani
-
November 21, 2021 at 7:11 amPython Project: Properties Maintenance System P8 | Ali's Photography Space...
-
January 5, 2022 at 7:05 amPython Project: Properties Maintenance System P9 | Ali's Photography Space...
-
February 13, 2022 at 7:07 amPython Project: Properties Maintenance System P10 | Ali's Photography Space...
-
February 20, 2022 at 7:10 amPython Project: Properties Maintenance System P11 | Ali's Photography Space...
-
February 27, 2022 at 7:13 amPython Project: Properties Maintenance System P12 | Ali's Photography Space...