pastebin - collaborative debugging tool
python.kpaste.net RSS

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

    
11
#!/usr/bin/python3
22
import sys
3+
import os.path
34
45
def easyOptionsArgs(lookingFor,theArgs):
56
    n = len(theArgs)
67
    theValue=""
78
    for i in range(1, n):
89
        if (sys.argv[i].startswith(lookingFor)):
910
            theValue=sys.argv[i].split("=")
1011
            return theValue[1:][0]
1112
    return theValue
1213
1314
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)
1718
18-
if __name__ == "__main__":
19+
#print("inFile",inFile)
19-
    main()
20+
print("outFile",outFile)
21+
print("commandEh",commandEh)
2022
2123
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)
2931
30-
32+
        print(newCommand)
3133
3234
3335

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at