質問するログイン新規登録

回答編集履歴

2

d

2020/08/11 02:07

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -7,8 +7,8 @@
7
7
  target_dir = Path("pystyle/opencv")
8
8
 
9
9
 
10
- def get_first_file(sub_dir):
10
+ def get_first_filename(sub_dir):
11
- paths = sorted([x.stem for x in sub_dir.iterdir()])
11
+ paths = sorted([x.stem for x in sub_dir.glob("*.txt")])
12
12
 
13
13
  return paths[0] if paths else None
14
14
 

1

a

2020/08/11 02:07

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -4,11 +4,11 @@
4
4
  ```python
5
5
  from pathlib import Path
6
6
 
7
- target_dir = Path("sample")
7
+ target_dir = Path("pystyle/opencv")
8
8
 
9
9
 
10
10
  def get_first_file(sub_dir):
11
- paths = sorted(sub_dir.glob("*.txt"))
11
+ paths = sorted([x.stem for x in sub_dir.iterdir()])
12
12
 
13
13
  return paths[0] if paths else None
14
14