This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Jython : loop in a directory

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would like replace characters special for many XML files in a directory and not for one file.

Exemple :
In my D:\JYTHON\,I have the follow files and I would like replace for TEST1.xml and TEST2.xml.
- TEST1.xml
- TEST2.xml

Below my code for TEST1.xml which works :

t = open("D:\JYTHON\TEST1.xml").read()
s = unicode( t, "utf-8" )
s = s.replace('&', '')
s = s.replace('è', '')
s = s.replace('é', '')
s = s.replace('*', '')
s = s.replace('%', '')
s = s.replace('@', '')
s = s.replace('ç', '')
s = s.replace('à', '')
s = s.replace('#', '')
f = open("D:\JYTHON\TEST2.xml", 'w')

Thank you in advance
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!