creating a list with python
at 2017-12-24 13:01:00.
this is a simple list with the name of portList that you can call latter on
portList = [21,22,443]
adding more numbers to it:
portList.append(80)
remove from list:
portList.remove(443)
how many numbers / values are before something:
portList.index(80)
how many values are totally in the list
len(portList)
and sort it:
print portList.sort()
add words:
list2 = ['Apple','Orange','Melon','Strawberry']
make them all lower case:
print list2.lower()
make them all upper case:
print list2.upper()
replace some stuff:
print list2.replace("Orange","peach")
make a word list separated by line:
print '\n'.join(list2)
and for numbers:
print '\n'.join(map(str, List))
make a word list separated by comma and a space:
print ', '.join(mylist)
and for numbers:
print str(List).strip('[]')