I am new to Python and know that there is an easier way but I can't seem to figure out what it is. I want to strip some characters from a string and this is the way I did it:
But I don't think that is the right BIF because it only affects leading and trailing; at least based on the documentation. What am I missing? If there are other suggestions related to getting the timestamp without all the dashes, semi-colons, and periods, I am open to those as well.
filenametmp = 'pageadmin' + str(datetime.datetime.utcnow()) filenametmp2 = filenametmp.replace('-','') filenametmp3 = filenametmp2.replace(':','') filenametmp4 = filenametmp3.replace('.','') filename = filenametmp4.replace(' ','') filename = filename + '.txt'
filenametmp = 'pageadmin' + str(datetime.datetime.utcnow()) filename = filenametmp.strip(':-.')