背景
复制一个目录时,提示有个文件名太长未能复制成功,然后忘记是哪个了,现在要靠脚本把它找出来。
代码
#!/usr/bin/python
import getopt
import os
import sys
def parse_args(argv):
num = 0
path = '.'
try:
'''
Syntax: getopt.getopt(args, options, [long_options])
Parameters:
args: List of arguments to be passed.
options: String of option letters that the script wants to recognize. Options that require an argument should be followed by a colon (:).
long_options: List of the string with the name of long options. Options that require arguments should be followed by an equal sign (=).
'''
# h i o 为可选项,其中 i 和 o 后面需要跟参数
opts, args = getopt