私がしたいこと
ユーザーが選択したフォルダーに移動し、このフォルダーのファイルを表示します
これをどのように行いたいか
ユーザーにファイルのリストとそれらが含まれているフォルダーを表示し、ユーザーがいずれかを選択できるようにしたいと思います。
コード
私はこれを試しました:
#!/usr/bin/env python
import os, sys, glob
os.chdir(glob.glob("/var/mobile/TP/")[0])
print("Please select a Texture Pack (##):")
items = os.listdir(".")
i = 1
for item in items:
print("[%.2d] %s" % (i, item))
i += 1
#And then something that will assign the variables to the listed items, like
*firstlisteditem*=a ; *secondlisteditem*=b #... and so on
#and then i need to get the user to tell me which folder he wants to go to. This I will do using a number.
se=raw_input ()
if "1" in se then
exec /var/mobile/TP/$a
if "2" in se then
exec /var/mobile/TP/$b