def filterChars(fName):
     with open(fName) as f:
         first=True
         for l in f.readlines():
             if first and replaceFirstLine:
                 l=replaceFirstLine+"\n"
             elif stripCharacters:
                 l=l.translate(None,stripCharacters)
             first=False
             yield toByte(l)
Example #2
0
    def writeCSV(self, fName, delimiter=","):
        """Write data to a CSV-file
        @param fName: Name of the file
        @param delimiter: Delimiter to be used in the CSV-file"""

        f = open(fName, "wb")
        if PY3:
            f.write(toByte(delimiter.join(self.names()) + "\n"))
        else:
            f.write(delimiter.join(self.names()) + "\n")

        numpy.savetxt(f, self.data, delimiter=delimiter)
    def writeCSV(self,fName,
                 delimiter=","):
        """Write data to a CSV-file
        @param fName: Name of the file
        @param delimiter: Delimiter to be used in the CSV-file"""

        f=open(fName,"wb")
        if PY3:
            f.write(toByte(delimiter.join(self.names())+"\n"))
        else:
            f.write(delimiter.join(self.names())+"\n")

        numpy.savetxt(f,self.data,delimiter=delimiter)
Example #4
0
 def filterChars(fName):
     if "readlines" in dir(fName):
         f = fName
     else:
         f = open(fName)
     first = True
     for l in f.readlines():
         if first and replaceFirstLine:
             l = replaceFirstLine + "\n"
         elif stripCharacters:
             l = l.translate(None, stripCharacters)
         first = False
         try:
             yield toByte(l)
         except AttributeError:
             yield l
     if "close" in dir(f):
         f.close()
 def filterChars(fName):
     if "readlines" in dir(fName):
         f=fName
     else:
         f=open(fName)
     first=True
     for l in f.readlines():
         if first and replaceFirstLine:
             l=replaceFirstLine+"\n"
         elif stripCharacters:
             l=l.translate(None,stripCharacters)
         first=False
         try:
             yield toByte(l)
         except AttributeError:
             yield l
     if "close" in dir(f):
         f.close()