Difference between
modified post 71d5 by Anonymous on Fri 30th Apr 2021 01:19
original post 58d8b by Anonymous on Mon 12th Apr 2021 18:07
Download diff
Show
old version |
new version |
both versions
| 1 | 1 | #!/usr/bin/python3 | |
| 2 | 2 | import sys | |
| 3 | + | import os.path | |
| 3 | 4 | ||
| 4 | 5 | def easyOptionsArgs(lookingFor,theArgs): | |
| 5 | 6 | n = len(theArgs) | |
| 6 | 7 | theValue="" | |
| 7 | 8 | for i in range(1, n): | |
| 8 | 9 | if (sys.argv[i].startswith(lookingFor)): | |
| 9 | 10 | theValue=sys.argv[i].split("=") | |
| 10 | 11 | return theValue[1:][0] | |
| 11 | 12 | return theValue | |
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | - | def main(): | |
| 15 | + | #inFile = easyOptionsArgs("-f",sys.argv) | |
| 15 | - | InFileName = easyOptionsArgs("-f",sys.argv) | |
| 16 | + | outFile = easyOptionsArgs("-o",sys.argv) | |
| 16 | - | print("InFileName",InFileName) | |
| 17 | + | commandEh = easyOptionsArgs("-c",sys.argv) | |
| 17 | 18 | ||
| 18 | - | if __name__ == "__main__": | |
| 19 | + | #print("inFile",inFile) | |
| 19 | - | main() | |
| 20 | + | print("outFile",outFile) | |
| 21 | + | print("commandEh",commandEh) | |
| 20 | 22 | ||
| 21 | 23 | ||
| 22 | - | ||
| 24 | + | for line in sys.stdin: | |
| 23 | - | ||
| 25 | + | line = line.strip() | |
| 24 | - | ||
| 26 | + | print("#" + line ) | |
| 25 | - | ||
| 27 | + | newFile = line + outFile | |
| 26 | - | ||
| 28 | + | if os.path.isfile(newFile) is False: | |
| 27 | - | ||
| 29 | + | newCommand=commandEh.replace("%1",line) | |
| 28 | - | ||
| 30 | + | newCommand=newCommand.replace("%2",newFile) | |
| 29 | 31 | ||
| 30 | - | ||
| 32 | + | print(newCommand) | |
| 31 | 33 | ||
| 32 | 34 | ||
| 33 | 35 |
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
python.kpaste.net RSS