Python Forum
input inbetween two strings?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
input inbetween two strings?
#1
I would like advice on how i can have a second string at the end of the input area in the bellow code.
What i am trying to do is have "Enter items weight" _ "lbs"
The underscore is were the number will be input.

This is what i currently have without the "lbs"
pounds = int(input("Enter item weight "))
Reply
#2
Take a look at curses module. Not sure, but I think it can be useful for this task.
Reply
#3
(Sep-23-2020, 12:16 AM)scidam Wrote: Take a look at curses module. Not sure, but I think it can be useful for this task.

I took a look and at my level of knowledge i dont see anything that can translate as a solution to the problem. You probably are on to something with it because after searching around for solutions i have seen at least two other questions like this answered with reference to curses module.

Very funny, something seemingly simple is quite complicated.Think
Reply
#4
Simpler do something like this.
>>> pounds = int(input("Enter item weight in lbs: "))
Enter item weight in lbs: 75

>>> pounds = f'Your input weight was {pounds} lbs'
>>> pounds
'Your input weight was 75 lbs'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 757 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 1,755 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Finding multiple strings between the two same strings Slither 1 2,511 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  Changing User Input Strings Into Set Integer Values Mario128843 3 3,151 May-01-2018, 03:32 AM
Last Post: Mario128843
  lists, strings, and byte strings Skaperen 2 4,214 Mar-02-2018, 02:12 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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