Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rjust part of a string
#1
I am trying to use the rjust method to align part of a string in the following text:

for key in breakfast:
print('%s \t %d calories'%(key,breakfast[key]))


I want to rjust the %d calories part of the string. Not the entire string. Is there a way to do this?
Reply


Messages In This Thread
rjust part of a string - by pythonprogrammer - Sep-16-2019, 11:29 PM
RE: rjust part of a string - by ichabod801 - Sep-17-2019, 12:40 AM
RE: rjust part of a string - by snippsat - Sep-17-2019, 12:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ElementTree get attribute value part of string paulo79 1 2,209 Apr-05-2022, 09:13 PM
Last Post: deanhystad
  How to get values from part of a string? mahi926 1 1,890 May-16-2019, 07:27 AM
Last Post: buran

Forum Jump:

User Panel Messages

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