(我的守则):
import csv
import re
import string
import sys
import fileinput
import os
import random
import glob
import getopt
def getSymbols(filename):
f = file(filename)
while True:
line = f.readline()
if len(line) == 0:
break
print line,
f.close()
if len(sys.argv) < 2:
print 'No action specified.'
sys.exit()
elif:
print "No option"
sys.exit()
else:
for filename in sys.argv[1]:
readfile(filename)
with open(filename) as f:
for line in f:
if 'symbols' in line:
print "Total Number of Symbols:\n",line.strip(' has ');
getSymbols(filename)
Run Code Online (Sandbox Code Playgroud)
我有一个要求,我无法找到解决方案:
如何在命令行中将多个文件路径作为参数传递?例如:
test.py …Run Code Online (Sandbox Code Playgroud) python ×1