Words Line Up in Order
Now, let's consider the order of words within each file. What if we wanted to collect the first word from each file, then the second word from each file, and so on?
Your task is to write a Python script, step3_code.py, that takes the n-th word from each input file and writes them into a new file named output/n. Here, 'n' represents the word position (starting from 1). The output files should be created in the /home/labex/project/output/ directory.
For example, if we consider the first words of each file, the content of output/1 should be:
## output/1, start count with 1.
CentOS Java A Python Ubuntu
Similarly, for the 100th words (if they exist), the content of output/100 should be:
## output/100, the 100-th file, only java, linux and program have 100-th word.
applications and the
Requirements
- The
output folder should be located at /home/labex/project/.
- The order in which files are read does not matter; only the word order within each file is important.
- Punctuations are not considered part of words and should be excluded.