- #!/usr/bin/env python
- # -*- coding: iso-8859-15 -*-
-
- # nettoyer le copier/coller du CodeSource vers python
- # en effacant le # ou le numero de ligne
-
- ############################################################################
- # Copyright (C) 2006 Andre Connes
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
- ############################################################################
- # File : cs2py.py
- # Author : Andre Connes
- # Mailto : andre.connes@wanadoo.fr
- # Date : 29/08/2006
- # Licence : GNU/GPL Version 2 ou plus
- #
- # Description:
- # ------------
- #
- # @version $Id: Exp $
- # @author Andre Connes
- # @project
- # @copyright Andre Connes 29/08/2006
- #
- #
- #########################################################################
-
- import sys
-
- if len(sys.argv) < 3:
- print "Usage : %s fichier_source fichier_but" % sys.argv[0]
- sys.exit(1)
-
- fsname = sys.argv[1]
- fbname = sys.argv[2]
-
- fs =open(fsname,'r')
- fb =open(fbname,'w')
-
- while 1:
- ligne=fs.readline() # lit le caractere eol
- if ligne=="":
- break
- if ligne[0] == "#":
- nouvelleligne = ligne[2:]
- else:
- nouvelleligne = ligne[ligne.index(".")+2:]
- print ".",
- fb.write(nouvelleligne)
- print "\nTermine !\n\n*** Faites un chmod +x fichier_but (sous *NIX) ***"
- fs.close()
- fb.close
-
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# nettoyer le copier/coller du CodeSource vers python
# en effacant le # ou le numero de ligne
############################################################################
# Copyright (C) 2006 Andre Connes
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
############################################################################
# File : cs2py.py
# Author : Andre Connes
# Mailto : andre.connes@wanadoo.fr
# Date : 29/08/2006
# Licence : GNU/GPL Version 2 ou plus
#
# Description:
# ------------
#
# @version $Id: Exp $
# @author Andre Connes
# @project
# @copyright Andre Connes 29/08/2006
#
#
#########################################################################
import sys
if len(sys.argv) < 3:
print "Usage : %s fichier_source fichier_but" % sys.argv[0]
sys.exit(1)
fsname = sys.argv[1]
fbname = sys.argv[2]
fs =open(fsname,'r')
fb =open(fbname,'w')
while 1:
ligne=fs.readline() # lit le caractere eol
if ligne=="":
break
if ligne[0] == "#":
nouvelleligne = ligne[2:]
else:
nouvelleligne = ligne[ligne.index(".")+2:]
print ".",
fb.write(nouvelleligne)
print "\nTermine !\n\n*** Faites un chmod +x fichier_but (sous *NIX) ***"
fs.close()
fb.close