Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

I can't make the last line spread across in my display

$
0
0

I have the following code to print a schedule from inputs but can't make the last line spread under the like the header does.

My showRecord code is as follows...

Class Appointment:    def __str__(appt):        return f'{appt.date} {appt.start} {appt.end} {appt.description} {appt.venue} {appt.priority}'

OTHER CODE UNTIL

def showRecords(schedule):    print('{:<15}{:<10}{:<8}{:<25}{:<25}{:<10}'.format("Date","Start","End","Subject","Venue","Priority")) # '<' here aligns text to left    print('{:<15}{:<10}{:<8}{:<25}{:<25}{:<10}'.format("----","-----","---","-------","-----","--------"))    for appointment in schedule:        print(appointment)    else:        print("No more appointments found.")

I have tried the following

print('{:<15}{:<10}{:<8}{:<25}{:<25}{:<10}'.format(schedule))

...and...

print('{:<15}{:<10}{:<8}{:<13}{:<11}{:<10}'.format(date, start, end, description, venue, priority))

but the last line just bunches up as follows...

enter image description here

I've tried several codes as noted above and can't make it work. Please help.

NOTE: I've added the rest of the code!


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>