Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone please help me?
#11
Yeah, I'm familiar with that aspect, but I'm just unsure why a character had to be subtracted in this particular instant. Before I read your reply, I used [-1] instead of split(), FYI. Thank you so much, man! You're awesome, and helped me tremendously!
Reply
#12
Oh, that's because text.get() apparently automatically appends a newline (or '\n') to your string.
[-1] returns the last element in a list or another iterable - for instance, if you had the list a = [1,2,3,4,5], a[-1] would return 5. It doesn't actually change the list.
BTW I've updated my post. Apparently Tkinter will remove the newline if you provide the correct argument (see post for details) so you don't have to use .strip() after all.
OS: Arch
Editor: Atom with Material Syntax UI and the Termination terminal plugin

Micah 6:8
Reply
#13
Even better!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020