ホーム

Get file list in specified directory - python

2018年5月4日

Description

I want to obtain a list of files in a specified directory. In this case, obtain a list of tmx files

 

Implementation

<pre class="prettyprint">import glob

list_of_file = glob.glob("/Users/softyuyo/Desktop/TMXs/*.tmx")

i = 0
while i &lt; len(list_of_file):
	print(list_of_file[i])
	i += 1</pre>

 

Debug

$ /usr/bin/python /Users/user/Desktop/polyglot.py
/Users/softyuyo/Desktop/TMXs/c.tmx
/Users/softyuyo/Desktop/TMXs/b.tmx
/Users/softyuyo/Desktop/TMXs/a.tmx
/Users/softyuyo/Desktop/TMXs/e.tmx
/Users/softyuyo/Desktop/TMXs/d.tmx
/Users/softyuyo/Desktop/TMXs/f.tmx
/Users/softyuyo/Desktop/TMXs/g.tmx
/Users/softyuyo/Desktop/TMXs/j.tmx
/Users/softyuyo/Desktop/TMXs/i.tmx
/Users/softyuyo/Desktop/TMXs/h.tmx
Pocket
LinkedIn にシェア



新規webサービスの開発の依頼ならoffテク⭐️

低コストで、Reactなどモダン言語での新規webサービス開発を承ります

-ホーム

Copyright© off , 2020 All Rights Reserved Powered by AFFINGER5.