Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. cost= "£56"
  2. currencySymbol = cost[0]
  3. print (currencySymbol, cost[1:])
  4.  
  5. Â: £56
  6.  
  7. import re
  8. cost= "£560,000"
  9. match = re.search(r'([D]+)([d,]+)', cost)
  10. output = (match.group(1), match.group(2).replace(',',''))
  11. print (output);
  12.  
  13. output -->('£', '560000')
  14.  
  15. cost= "£56"
  16. currencySymbol = cost[0]
  17. print (currencySymbol, cost[1:])
  18. #when using file use encoding
  19. with open('index.html', encoding="UTF-8") as productFile:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement