What does %s mean in a Python format string?

What does %s mean in Python? And what does the following bit of code do?

For instance…

 if len(sys.argv) < 2:
     sys.exit('Usage: %s database-name' % sys.argv[0])

 if not os.path.exists(sys.argv[1]):
     sys.exit('ERROR: Database %s was not found!' % sys.argv[1])

7 Answers
7

Leave a Comment