I have 2 questions:
Is there a more efficient way to create an alphanumeric list like the following?
def CreateList(): numb=range(1,21) StringList=[] for i in numb: StringList.append("C"+str(i)) return StringList
StringList=CreateList() print (StringList)
['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'C10', 'C11', 'C12', 'C13', 'C14', 'C15', 'C16', 'C17', 'C18', 'C19', 'C20']
- If I have an alphanumeric list like the one below, what the best way to sort it?
['C1', 'C10', 'C11', 'C12', 'C13', 'C14', 'C15', 'C16', 'C17', 'C18', 'C19', 'C2', 'C20', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9']
StringList = ["C" + str (i) for i in range (1,21)]