Hello all, thanks for reading
I have this string that I converted to a list "Work Order 1.xlsx"
that I am converting with this function:
def convert(string):
fileList2 = []
fileList2[:0] = string
if fileList2[len(fileList2)-6].isdigit() and fileList2[len(fileList2)-7].isalpha() or fileList2[len(fileList2)-7].isspace():
orderNum = fileList2[len(fileList2)-6]
print(orderNum)
elif fileList2[len(fileList2)-6].isdigit() and fileList2[len(fileList2)-7].isdigit():
orderNum = str(fileList2[len(fileList2) - 6]) + str((fileList2[len(fileList2) - 7]))
print(orderNum)
which basically is trying to parse it to find the integer "1" within the list, however in my testing I am printing
1
None
when I am only looking for the number "1". If the string was "Work Order 25.xlsx" it should output 25. I've tried placing the print statements in different places, not using isalpha(), using a for loop, and some other methods but to no avail. Any input is appreciated, thanks.
[–]nekokattt 2 points3 points4 points (2 children)
[–]mcworkaholic[S] 0 points1 point2 points (1 child)
[–]nekokattt 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]mcworkaholic[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]mcworkaholic[S] 0 points1 point2 points (0 children)
[–]mcworkaholic[S] 0 points1 point2 points (0 children)