Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract version in a string
#1
Hi,

I need help to extract only version in the following string.

str="psutil-5.4.5-cp27-none-win32.whl"

output should be : 5.4.5

Appreciate help on this.

Thx,
Lokesh
Reply
#2
What have you tried?

Never use str as name or you will be unpleasantly surprised.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
https://www.python.org/dev/peps/pep-0427...convention
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to extract specific key value pair from string? aditi06 0 470 Apr-15-2021, 06:26 PM
Last Post: aditi06
Question How to extract multiple text from a string? chatguy 2 499 Feb-28-2021, 07:39 AM
Last Post: bowlofred
  Extract continuous numeric characters from a string in Python Robotguy 2 548 Jan-16-2021, 12:44 AM
Last Post: snippsat
  Please support regex for version number (digits and dots) from a string Tecuma 4 837 Aug-17-2020, 09:59 AM
Last Post: Tecuma
  extract a dictionary from a string berc 4 917 Jul-30-2020, 06:58 AM
Last Post: berc
  Extract data from large string pzig98 1 693 Jul-20-2020, 12:39 AM
Last Post: Larz60+
  xml.etree.ElementTree extract string values matthias100 2 759 Jul-12-2020, 06:02 PM
Last Post: snippsat
  Extract email addresses from string and store them in a list oslosurfer 2 874 Nov-24-2019, 03:35 PM
Last Post: oslosurfer
  Need help to extract particular string lokesh 3 884 Sep-04-2019, 08:16 PM
Last Post: snippsat
  python3 List to array or string to extract data batchenr 4 1,448 May-28-2019, 01:44 PM
Last Post: buran

Forum Jump:

User Panel Messages

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