Python how to add number to string -


I want to add a number to my URL to look like this: www.exemple.com/001 www.exemple.com / 002 ... www.exemple.com/009 www.exemple.com/010 ... www.exemple.com/100 www.exemple.com/101 So I make this script in Python

  url = 'www.exemple.com/': if y & lt; 10: y = '00' + y elif y and lt; 100: y = '0' + y and: pass url + = str (y) print url  

but I have this error:

  indentation Error: unindent does not match any external indentation level  

Any idea to fix this and thanks a lot guys

If I understand your question, I think that you

  Url = 'www.exemple.com/' # & lt; Like something like - Example for x in xrange (1, 11, 1): Print Url + "{0: 03d}". What format (x)  

prevents at 10 and output

  www.exemple.com/001 www program file Mple.com/002 www. Exemple.com/003 www.exemple.com/004 www.exemple.com/005 www.exemple.com/006 www.exemple.com/007 www.exemple.com/008 www.exemple.com/ 009 www.exemple .com / 010  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -