Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions bella/lister.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import sys
import os
import random

# function define

def nomal_mode():
print("nomal mode")
for (path, dirs, files) in os.walk(sys.argv[1]):
# print("# root : " + root)
if len(dirs) > 0:
for dir_name in dirs:
print("dir: " + dir_name)

if len(files) > 0:
for file_name in files:
print("file: " + file_name)

def random_mode():
print("random mode")
randList = []
for (path, dirs, files) in os.walk(sys.argv[1]):
if len(dirs) > 0:
for dir_name in dirs:
randList.append(dir_name)

if len(files) > 0:
for file_name in files:
randList.append(file_name)



sampleList = random.sample(randList, len(randList))
Comment on lines +30 to +33

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 사이 간격은 한 줄 또는 두 줄이 최대여야합니다. 지금은 4줄이 있네요.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변수명은 언더스코어(_) 기반 소문자가 되어야합니다. PEP8을 참조해주세요.


for i in sampleList:
print(i)

# =====================================================
# main

length = len(sys.argv)
if length>2:
option = sys.argv[2]


if length == 2:
nomal_mode()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifelif 사이 간격이 없어야 합니다.

if 0:
    pass
elif 1:
    pass


elif option == "random":
random_mode()


elif option == "-ignore":
print("ignore mode")