Hi, I wrote these few lines to create different file of the same extension.
I was wondering if there is a better way to perform this task!
In my folder I have all the items of mylist and a xaa.sh file. Starting from this one I want to obtain all these files .sh.
mylist= ["xaa","xab","xac","xad","xae","xaf","xag","xah","xai"]
for el in l:
f=file("xaa.sh","r")
a=f.read()
b=a.replace("xaa",el)
f=file(el+".sh","w")
f.write(b)
Thanks!
Hello damiano.bassani!
We believe that this post does not fit the main topic of this site.
Not really a bioinformatics question, this is about either python or shell scripting.Context has since been added in a comment, making this somewhat more relevant (those disagreeing are free to revert my reopening).For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!