0

How can I format my varible Number to format like this:

1
10
100
1 000
10 000
100 000
1 000 000
10 000 000
100 000 000
1 000 000 000

My plan is to reformat my Numberstring then check if str(Number)in element.text

element.text output is:

xxxxxxx Sälj xxxxxxx
B xxxxxxx B zzz
zzzzzz zzz 1 500 0,767 1 150,50 SEK 19:14
Time=datetime.now().strftime('%H:%M')[:]
Time=19:14
Action=Sälj
Number=int(1500)
sring=f'{number:,}'
sring=sring.replace(','," ")
Number=sring
result_elements = driver2.find_elements_by_xpath("""//*[@data-deal_id]""")
for element in result_elements:
    if Time,Action,Number in element.text:
            print('order was executed')
            print(element.text)
johanswe
  • 33
  • 7
  • It's not clear from your example what you want your final output to be based on the input. Can you detail that more? Also, you put line breaks in your question that didn't show up, because StackOverflow requires the backticks or double carriage returns. – aschultz Aug 23 '19 at 21:02
  • Sorry I had some issues when posting question, I have made some edits to explain better. – johanswe Aug 24 '19 at 10:38
  • number=int(2132133) sring=f'{number:,}' sring=sring.replace(','," ") print(sring) Found the answer here: https://stackoverflow.com/questions/1823058/how-to-print-number-with-commas-as-thousands-separators – johanswe Aug 24 '19 at 11:06

0 Answers0