Read a group of files as a list
Hi!! I'm a beginner in python and I'm trying to use the files from a "folder" as a list. What I want to do is read each one as a list, but just the name of the file, the data inside doesn't matter. How can I do it? I was trying using a list, but I don't know how "convert" the elements (files) to a list that I can read and manipulate... Thanks in advance for your help!! Citlaly -- http://mail.python.org/mailman/listinfo/python-list
Read a group of files as a list
Hi!! I'm a beginner in python and I'm trying to use the files from a "folder" as a list. What I want to do is read each one as a list, but just the name of the file, the data inside doesn't matter. How can I do it? I was trying using a list, but I don't know how "convert" the elements (files) to a list that I can read and manipulate... Thanks in advance for your help!! Citlaly -- http://mail.python.org/mailman/listinfo/python-list
Re: Read a group of files as a list
Thanks a lot Bearophile!! It works great! Well, it seems something
easy for experts, but for beginners as me, your help is very useful...
thanks!!
Citlalyy
>
> >>> import os
> >>> os.listdir("...path...")
> [ file names... ]
>
> If you are using Windows I suggest you to invert the slashes of the
> path, so instead of:
> "C:\WINNT\Fonts"
> Use:
> "C:/WINNT/Fonts"
>
> Bye,
> bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Re: Read a group of files as a list
Thanks Steven! I'll check it!! Saludos!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Read a group of files as a list
Thanks Steven! I'll check it!! Saludos!! Citlalyy -- http://mail.python.org/mailman/listinfo/python-list
