この元の質問の続きとして: Python: Stripping elements of a string array based on first character of each element
このifステートメントを展開できるかどうか疑問に思っています:
with open(bom_filename, 'r') as my_file:
file_array = [word.strip() for word in my_file if word.startswith("/")]
含めて2番目の条件:
with open(bom_filename, 'r') as my_file:
file_array = [word.strip() for word in my_file if (word.startswith("/")) & not(word.endswith("/"))]
これにより構文エラーが発生しますが、使用できる代替構文がいくつかあることを願っています!