"read files and write into another files python" Code Answer's
You're definitely familiar with the best coding language Python that developers use to develop their projects and they get all their queries like "read files and write into another files python" answered properly. Developers are finding an appropriate answer about read files and write into another files python related to the Python coding language. By visiting this online portal developers get answers concerning Python codes question like read files and write into another files python. Enter your desired code related query in the search bar and get every piece of information about Python code related question on read files and write into another files python.
read files and write into another files python
import sys
import glob
import os.path
list_of_files = glob.glob('/Users/Emily/Topics/*.txt') #500 files
for file_name in list_of_files:
print(file_name)
# This needs to be done *inside the loop*
f= open(file_name, 'r')
lst = []
for line in f:
line.strip()
line = line.replace("\n" ,'')
line = line.replace("//" , '')
lst.append(line)
f.close()
f=open(os.path.join('/Users/Emily/UpdatedTopics',
os.path.basename(file_name)) , 'w')
for line in lst:
f.write(line)
f.close()
Source: stackoverflow.com
All those coders who are working on the Python based application and are stuck on read files and write into another files python can get a collection of related answers to their query. Programmers need to enter their query on read files and write into another files python related to Python code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about read files and write into another files python for the programmers working on Python code while coding their module. Coders are also allowed to rectify already present answers of read files and write into another files python while working on the Python language code. Developers can add up suggestions if they deem fit any other answer relating to "read files and write into another files python". Visit this developer's friendly online web community, CodeProZone, and get your queries like read files and write into another files python resolved professionally and stay updated to the latest Python updates.