5

We are using versioning. The current version is 0.2.3 i would like to increment by 0.0.1 using python. Getting below error.

tagNumber = 0.2.3 ^ SyntaxError: invalid syntax

3
  • try as a string, or a list. Commented Oct 23, 2018 at 15:37
  • Python understands versions and makes manipulation of them quite easy - please have a look at the other question linked. Commented Oct 23, 2018 at 15:40
  • you can use my answer stackoverflow.com/a/70940341/11567596 Commented Feb 1, 2022 at 12:10

1 Answer 1

7

You could do something like this:

def increment_ver(version):
    version = version.split('.')
    version[2] = str(int(version[2]) + 1)
    return '.'.join(version)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.