Question: I have three int variables representing different octets in an IP address and an 'i' variable that is part of a loop. I am trying to set all four variables to a single string and save it to a variable that is returned by a method. I can't figure out how to do this and have to look like an actual IP address (i.e. 192.168.1.1). Does anyone know how I might go about doing this? I am hoping to do this in Python 2.7.6

Answer: 
String formatting is one way to get there. But there are two built-in functions that might come in handy as well :

«str» to convert just about any type to str 
and 
«join» to concatenate strings with a separator in between. 

Hence for a given list of integers : 

```
some_list = [192, 168, 1, 1]

```

you might use the following line : 

```
'.'.join( map(str, some_list) )

```

Which applies the function «str» to all elements in the list «some\_list», returns a list of strings which gets concatenated by the separator of your choice, here «.»

This will work no matter the length of your list, and the variety of types in the list (provided they have a «repr» function).
You can do something like this:

```
mylist = [192, 168, 1, 1]
endstring = ''
for s in mylist:
  endstring += "%s." %str(s)

```