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
  extract substring from a string before a word !! evilcode1 3 491 Nov-08-2023, 12:18 AM
Last Post: evilcode1
Question Extracting Version Number from a String britesc 2 1,030 May-31-2023, 10:20 AM
Last Post: britesc
  Extract a string between 2 words from a text file OscarBoots 2 1,826 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  How to extract specific key value pair from string? aditi06 0 2,483 Apr-15-2021, 06:26 PM
Last Post: aditi06
Question How to extract multiple text from a string? chatguy 2 2,312 Feb-28-2021, 07:39 AM
Last Post: bowlofred
  Extract continuous numeric characters from a string in Python Robotguy 2 2,580 Jan-16-2021, 12:44 AM
Last Post: snippsat
  Please support regex for version number (digits and dots) from a string Tecuma 4 3,102 Aug-17-2020, 09:59 AM
Last Post: Tecuma
  extract a dictionary from a string berc 4 2,784 Jul-30-2020, 06:58 AM
Last Post: berc
  Extract data from large string pzig98 1 2,095 Jul-20-2020, 12:39 AM
Last Post: Larz60+
  xml.etree.ElementTree extract string values matthias100 2 4,858 Jul-12-2020, 06:02 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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