os.walk examples
This commit is contained in:
parent
5d1f116933
commit
173498f32b
5 changed files with 44 additions and 0 deletions
20
python-temel/list.txt
Normal file
20
python-temel/list.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
/home/hwpplayer1/Documents
|
||||
/home/hwpplayer1/Documents/iktisat
|
||||
/home/hwpplayer1/Documents/cs
|
||||
/home/hwpplayer1/Documents/revised
|
||||
/home/hwpplayer1/Documents/pgp
|
||||
/home/hwpplayer1/Documents/lkdtr
|
||||
/home/hwpplayer1/Documents/cpp
|
||||
/home/hwpplayer1/Documents/cv
|
||||
/home/hwpplayer1/Documents/lisp
|
||||
/home/hwpplayer1/Documents/translate-gnu-fsf
|
||||
/home/hwpplayer1/Documents/text
|
||||
/home/hwpplayer1/Documents/infra
|
||||
/home/hwpplayer1/Documents/other
|
||||
/home/hwpplayer1/Documents/other/jekyll_and_hyde_librivox_64kb_mp3
|
||||
/home/hwpplayer1/Documents/rust
|
||||
/home/hwpplayer1/Documents/git
|
||||
/home/hwpplayer1/Documents/blog
|
||||
/home/hwpplayer1/Documents/mastodon
|
||||
/home/hwpplayer1/Documents/forum
|
||||
/home/hwpplayer1/Documents/twitter
|
9
python-temel/os.walk.list.txt.py
Normal file
9
python-temel/os.walk.list.txt.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
import os
|
||||
|
||||
try:
|
||||
f = open('list.txt', 'w')
|
||||
for root, dirs, files in os.walk('/home/hwpplayer1/Documents'):
|
||||
f.write(root + '\n')
|
||||
f.close()
|
||||
except:
|
||||
print('file cannot open!')
|
9
python-temel/os.walk.list.txt.py~
Normal file
9
python-temel/os.walk.list.txt.py~
Normal file
|
@ -0,0 +1,9 @@
|
|||
import os
|
||||
|
||||
try:
|
||||
f = open('list.txt', 'w')
|
||||
for root, dirs, files in os.walk('/'):
|
||||
f.write(root + '\n')
|
||||
f.close()
|
||||
except:
|
||||
print('file cannot open!')
|
3
python-temel/os.walk.py
Normal file
3
python-temel/os.walk.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
import os
|
||||
for root, dirs, files in os.walk('/'):
|
||||
print(root)
|
3
python-temel/os.walk.py~
Normal file
3
python-temel/os.walk.py~
Normal file
|
@ -0,0 +1,3 @@
|
|||
import os
|
||||
for root, dirs, files in os.walk('/'):
|
||||
print(root)
|
Loading…
Reference in a new issue