Python csv.QUOTE_MINIMAL属性代码示例

本文整理汇总了Python中csv.QUOTE_MINIMAL属性的典型用法代码示例。如果您正苦于以下问题:Python csv.QUOTE_MINIMAL属性的具体用法?Python csv.QUOTE_MINIMAL怎么用?Python csv.QUOTE_MINIMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在模块csv的用法示例。

在下文中一共展示了csv.QUOTE_MINIMAL属性的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def handle(self, *args, **options):
    documents = Document.objects.filter(verified=True)
    with open('docs_with_several_verified_entries.csv', 'wb') as csvfile:
      impwriter = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
      # report on documents validated more than once
      for doc in documents:
        form_entries = doc.form_entries.all()
        form_fields = doc.document_set.form.all()[0].fields.filter(verify=True)
        if len(form_entries) > 2:
          verified_entry_count = 0
          for fe in form_entries:
            fe_to_dict = fe.to_dict()
            #print "-------- For entry user %s." % fe_to_dict['username']
            if fe_to_dict['answer_Adjudicatario_verified'] or \
            fe_to_dict['answer_Tipo de gasto_verified'] or \
            fe_to_dict['answer_Importe total_verified']:
              verified_entry_count += 1
          if verified_entry_count > 1:
            print "The doc %s has more than one entry verified." % doc.id
            doc.unverify()
            doc.verify()
            impwriter.writerow([doc.id, doc.verified]) 
开发者ID:crowdata,项目名称:crowdata,代码行数:26,代码来源:report_on_entries.py


示例2: success_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def success_csv(self, url, rurl, port, IP, statuscode):
		if options().csvfile:
			if not options().csvfile.endswith(".csv"):
				csvfile = f"{options().csvfile}.csv"
			else:
				csvfile = options().csvfile
			if os.path.isfile(csvfile):
				pass
			else:
				with open(csvfile, "w") as csvf:
					writer = csv.writer(csvf, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
					writer.writerow(["URL", "REDIRECT", "PORT", "IP", "STATUS CODE"])
		with open(csvfile, "a") as csvf:
			writer = csv.writer(csvf, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
			writer.writerow([url, rurl, port, IP, statuscode]) 
开发者ID:DFC302,项目名称:statusparser,代码行数:19,代码来源:nocolor.py


示例3: _convert_xpt_to_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def _convert_xpt_to_csv(self):
        if not os.path.exists(self._csv_path):
            os.mkdir(self._csv_path)
        for i in range(len(self._cdcfiles)):
            f = self._cdcfiles[i]
            finfo = self._cdcfileinfo[i]
            xptfile = os.path.join(self._dirpath, f)
            csvfile = os.path.join(self._csv_path, f)
            csvfile = os.path.splitext(csvfile)[0]
            csvfile = csvfile + ".csv"
            if not os.path.exists(csvfile):
                print("converting ", finfo, ": ", xptfile, " to ", csvfile)
                with open(xptfile, 'rb') as in_xpt:
                    with open(csvfile, 'w',newline='') as out_csv:
                        reader = xport.Reader(in_xpt)
                        writer = csv.writer(out_csv, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
                        writer.writerow(reader.fields)
                        for row in reader:
                            writer.writerow(row) 
开发者ID:IBM,项目名称:AIX360,代码行数:22,代码来源:cdc_dataset.py


示例4: _test_default_attrs

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def _test_default_attrs(self, ctor, *args):
        obj = ctor(*args)
        # Check defaults
        self.assertEqual(obj.dialect.delimiter, ',')
        self.assertEqual(obj.dialect.doublequote, True)
        self.assertEqual(obj.dialect.escapechar, None)
        self.assertEqual(obj.dialect.lineterminator, "\r\n")
        self.assertEqual(obj.dialect.quotechar, '"')
        self.assertEqual(obj.dialect.quoting, csv.QUOTE_MINIMAL)
        self.assertEqual(obj.dialect.skipinitialspace, False)
        self.assertEqual(obj.dialect.strict, False)
        # Try deleting or changing attributes (they are read-only)
        self.assertRaises(TypeError, delattr, obj.dialect, 'delimiter')
        self.assertRaises(TypeError, setattr, obj.dialect, 'delimiter', ':')
        self.assertRaises(AttributeError, delattr, obj.dialect, 'quoting')
        self.assertRaises(AttributeError, setattr, obj.dialect,
                          'quoting', None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_csv.py


示例5: test_write_escape

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def test_write_escape(self):
        self._write_test(['a',1,'p,q'], 'a,1,"p,q"',
                         escapechar='\\')
        self._write_error_test(csv.Error, ['a',1,'p,"q"'],
                               escapechar=None, doublequote=False)
        self._write_test(['a',1,'p,"q"'], 'a,1,"p,\\"q\\""',
                         escapechar='\\', doublequote = False)
        self._write_test(['"'], '""""',
                         escapechar='\\', quoting = csv.QUOTE_MINIMAL)
        self._write_test(['"'], '\\"',
                         escapechar='\\', quoting = csv.QUOTE_MINIMAL,
                         doublequote = False)
        self._write_test(['"'], '\\"',
                         escapechar='\\', quoting = csv.QUOTE_NONE)
        self._write_test(['a',1,'p,q'], 'a,1,p\\,q',
                         escapechar='\\', quoting = csv.QUOTE_NONE) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:test_csv.py


示例6: test_bad_quote_char

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def test_bad_quote_char(self):
        data = '1,2,3'
        # Python 2.x: "...must be an 1-character..."
        # Python 3.x: "...must be a 1-character..."
        msg = '"quotechar" must be a(n)? 1-character string'
        tm.assert_raises_regex(TypeError, msg, self.read_csv,
                               StringIO(data), quotechar='foo')
        msg = 'quotechar must be set if quoting enabled'
        tm.assert_raises_regex(TypeError, msg, self.read_csv,
                               StringIO(data), quotechar=None,
                               quoting=csv.QUOTE_MINIMAL)
        msg = '"quotechar" must be string, not int'
        tm.assert_raises_regex(TypeError, msg, self.read_csv,
                               StringIO(data), quotechar=2) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:19,代码来源:quoting.py


示例7: test_null_quote_char

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def test_null_quote_char(self):
        data = 'a,b,c\n1,2,3'
        # sanity checks
        msg = 'quotechar must be set if quoting enabled'
        tm.assert_raises_regex(TypeError, msg, self.read_csv,
                               StringIO(data), quotechar=None,
                               quoting=csv.QUOTE_MINIMAL)
        tm.assert_raises_regex(TypeError, msg, self.read_csv,
                               StringIO(data), quotechar='',
                               quoting=csv.QUOTE_MINIMAL)
        # no errors should be raised if quoting is None
        expected = DataFrame([[1, 2, 3]],
                             columns=['a', 'b', 'c'])
        result = self.read_csv(StringIO(data), quotechar=None,
                               quoting=csv.QUOTE_NONE)
        tm.assert_frame_equal(result, expected)
        result = self.read_csv(StringIO(data), quotechar='',
                               quoting=csv.QUOTE_NONE)
        tm.assert_frame_equal(result, expected) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:27,代码来源:quoting.py


示例8: test_write_escape

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def test_write_escape(self):
        self._write_test(['a',1,'p,q'], 'a,1,"p,q"',
                         escapechar='\\')
        self.assertRaises(csv.Error,
                          self._write_test,
                          ['a',1,'p,"q"'], 'a,1,"p,\\"q\\""',
                          escapechar=None, doublequote=False)
        self._write_test(['a',1,'p,"q"'], 'a,1,"p,\\"q\\""',
                         escapechar='\\', doublequote = False)
        self._write_test(['"'], '""""',
                         escapechar='\\', quoting = csv.QUOTE_MINIMAL)
        self._write_test(['"'], '\\"',
                         escapechar='\\', quoting = csv.QUOTE_MINIMAL,
                         doublequote = False)
        self._write_test(['"'], '\\"',
                         escapechar='\\', quoting = csv.QUOTE_NONE)
        self._write_test(['a',1,'p,q'], 'a,1,p\\,q',
                         escapechar='\\', quoting = csv.QUOTE_NONE) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:20,代码来源:test_csv.py


示例9: create_csv_file

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def create_csv_file(data_root, output_file, fields):
    """
    create a csv file to store the paths of files for each patient
    """
    filenames = []
    patient_names = os.listdir(data_root + '/' + fields[0])
    print(len(patient_names))
    for patient_name in patient_names:
        patient_image_names = []
        for field in fields:
            image_name = data_root + '/' + field + '/' + patient_name
            image_name = image_name[len(data_root) + 1 :]
            patient_image_names.append(image_name)
        filenames.append(patient_image_names)
    with open(output_file, mode='w') as csv_file:
        csv_writer = csv.writer(csv_file, delimiter=',',
                            quotechar='"',quoting=csv.QUOTE_MINIMAL)
        csv_writer.writerow(fields)
        for item in filenames:
            csv_writer.writerow(item) 
开发者ID:HiLab-git,项目名称:PyMIC,代码行数:23,代码来源:write_csv_files.py


示例10: create_csv_file

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def create_csv_file(data_root, output_file, fields):
    """
    create a csv file to store the paths of files for each patient
    """
    filenames = []
    patient_names = os.listdir(data_root + '/' + fields[1])
    patient_names.sort()
    print('total number of images {0:}'.format(len(patient_names)))
    for patient_name in patient_names:
        patient_image_names = []
        for field in fields:
            image_name = field + '/' + patient_name
            # if(field == 'image'):
            #     image_name = image_name.replace('_seg.', '.')
            #     #image_name = image_name[:-4]
            patient_image_names.append(image_name)
        filenames.append(patient_image_names)
    with open(output_file, mode='w') as csv_file:
        csv_writer = csv.writer(csv_file, delimiter=',',
                            quotechar='"',quoting=csv.QUOTE_MINIMAL)
        csv_writer.writerow(fields)
        for item in filenames:
            csv_writer.writerow(item) 
开发者ID:HiLab-git,项目名称:PyMIC,代码行数:26,代码来源:write_csv_files.py


示例11: create_csv_file

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def create_csv_file(data_root, output_file):
    """
    create a csv file to store the paths of files for each patient
    """
    image_folder = data_root + "/" + "training_set"
    label_folder = data_root + "/" + "training_set_label"
    filenames = os.listdir(label_folder)
    filenames = [item for item in filenames if item[0] != '.']
    file_list = []
    for filename in filenames:
        image_name = "training_set" + "/" + filename.replace("_seg.", ".")
        label_name = "training_set_label" + "/" + filename
        file_list.append([image_name, label_name])
    with open(output_file, mode='w') as csv_file:
        csv_writer = csv.writer(csv_file, delimiter=',',
                            quotechar='"',quoting=csv.QUOTE_MINIMAL)
        csv_writer.writerow(["image", "label"])
        for item in file_list:
            csv_writer.writerow(item) 
开发者ID:HiLab-git,项目名称:PyMIC,代码行数:22,代码来源:write_csv_files.py


示例12: output

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def output(self):
        with open(RunParameters.OUTPUT_FILE, "a") as csv_file:
            writer = csv.writer(csv_file, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
            while (time.time() - self.start_time) < self.time_limit:
                #computing snapshots
                num_snapshots = 0
                for key in self.state_graph.states:
                    if self.state_graph.states[key].solid:
                        num_snapshots = num_snapshots+1
                #read coverage
                coverage_manager.pull_coverage_files("temp")
                coverage_manager.compute_current_coverage()             # output in coverage.txt
                current_coverage = coverage_manager.read_current_coverage()
                # write files
                writer.writerow([str(int(time.time()-self.start_time)), str(len(self.state_graph.states)),str(num_snapshots), str(self.num_restore), str(current_coverage)])
                time.sleep(120)
                print "current threads:  " + str(threading.active_count())
        csv_file.close() 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:27,代码来源:executor.py


示例13: dump_results_to_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def dump_results_to_csv(final_result, result_steps, decimal_precision, error_minimo):
    FILE_PATH = 'aproximation_result.csv'
    solution_len = len(final_result)
    with open(FILE_PATH, mode='w') as f:
        csv_writer = csv.writer(
            f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL
        )
        coordinates = [f'X_{i}' for i in range(solution_len)]
        csv_writer.writerow(
            ['i'] + coordinates + ['Norma 1', 'Norma 2', 'Norma 3', 'Criterio de Paro']
        )
        for i, step in enumerate(result_steps):
            array_elems = [round(number, decimal_precision) for number in step[0]]
            normas = [
                round(norma, decimal_precision) if norma != '-' else '-'
                for norma in step[1:]
            ]
            row = [i] + array_elems + normas + [error_minimo]
            csv_writer.writerow(row)
    return FILE_PATH 
开发者ID:Ambro17,项目名称:AmbroBot,代码行数:26,代码来源:utils.py


示例14: _test_default_attrs

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def _test_default_attrs(self, ctor, *args):
        obj = ctor(*args)
        # Check defaults
        self.assertEqual(obj.dialect.delimiter, ',')
        self.assertEqual(obj.dialect.doublequote, True)
        self.assertEqual(obj.dialect.escapechar, None)
        self.assertEqual(obj.dialect.lineterminator, "\r\n")
        self.assertEqual(obj.dialect.quotechar, '"')
        self.assertEqual(obj.dialect.quoting, csv.QUOTE_MINIMAL)
        self.assertEqual(obj.dialect.skipinitialspace, False)
        self.assertEqual(obj.dialect.strict, False)
        # Try deleting or changing attributes (they are read-only)
        self.assertRaises(AttributeError, delattr, obj.dialect, 'delimiter')
        self.assertRaises(AttributeError, setattr, obj.dialect, 'delimiter', ':')
        self.assertRaises(AttributeError, delattr, obj.dialect, 'quoting')
        self.assertRaises(AttributeError, setattr, obj.dialect,
                          'quoting', None) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:test_csv.py


示例15: write_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def write_csv(
    filename: str,
    data: Union[List, np.ndarray],
    column_names: Optional[List[str]] = None,
):
    """Write a csv file.
    Parameters
    ----------
    filename : str
        Filename for saving csv.
    data : list or ndarray
        Table values, contained in a list of lists or an ndarray.
    column_names : list, optional
        List of column names for table data.
    """
    with open(filename, mode='w', newline='') as csvfile:
        writer = csv.writer(
            csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL,
        )
        if column_names is not None:
            writer.writerow(column_names)
        for row in data:
            writer.writerow(row) 
开发者ID:napari,项目名称:napari,代码行数:26,代码来源:io.py


示例16: LoadULSFlatFile

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def LoadULSFlatFile(filename):
  records = {}
  header = []
  with open(filename, 'r') as data:
    reader = csv.reader(data, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
    for row in reader:
      if header == []:
        header = row
      else:
        r = {}
        for i in range(0, len(header)):
          r[header[i]] = row[i]
        key = r['unique_system_identifier'] + '.' + r['location_number'] + '.' + r['antenna_number']
        records[key] = r
        if len(row) != len(header):
          print '!!! Bad record: %s' % row
  print 'Read %d records from %s' % (len(records), filename)
  return records
# This method combines the extracted data from the CSV files, maintaining only
# the most recent 'last_action_date' entry for any particular rows.
# The keys for the row are the 'unique_system_identifer', 'location_number', and
# 'antenna_number' for the sector. 
开发者ID:Wireless-Innovation-Forum,项目名称:Spectrum-Access-System,代码行数:25,代码来源:extract_uls_data.py


示例17: __writeToCSV

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def __writeToCSV(self, dataRDD):
		if dataRDD.collect():
			with open(self.path, 'a') as csvfile:
				spamwriter = csv.writer(csvfile, delimiter = self.separator, quotechar = self.quote_char, quoting=csv.QUOTE_MINIMAL)
				currentTime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
				for row in dataRDD.collect():
					if self.debug:
						print row
					csvrow = [currentTime, row[0], row[1]]
					try:
						metadata = row[2]
					except:
						metadata = {}
					if metadata:
						for key in sorted(metadata):
							csvrow.append(metadata[key])
					spamwriter.writerow(csvrow)			
			print "%s - (%s) - Written %s Documents to CSV File %s " % (datetime.now().strftime("%Y-%m-%d %H:%M:%S"), self.title, len(dataRDD.collect()), self.path)
		else:
			print "%s - (%s) - No RDD Data Recieved" % (datetime.now().strftime("%Y-%m-%d %H:%M:%S"), self.title) 
开发者ID:makemytrip,项目名称:dataShark,代码行数:22,代码来源:out_csv.py


示例18: _record_stats

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def _record_stats(self, model, genome, loss, accuracy):
        with open(self.datafile, 'a') as csvfile:
            writer = csv.writer(csvfile, delimiter=',',
                                quotechar='"', quoting=csv.QUOTE_MINIMAL)
            row = list(genome) + [loss, accuracy]
            writer.writerow(row)
        met = loss if self._metric == 'loss' else accuracy
        if (self._bssf is -1 or
                self._metric_op(met, self._bssf) and
                accuracy is not 0):
            try:
                os.remove('best-model.h5')
            except OSError:
                pass
            self._bssf = met
            model.save('best-model.h5') 
开发者ID:joeddav,项目名称:devol,代码行数:19,代码来源:devol.py


示例19: to_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def to_csv(url, path):
    data = fetch_data(url)
    with open(path, 'w', newline='', encoding='utf_8') as csvfile:
        writer = csv.writer(csvfile,
                            delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writerow(data[0]._fields)
        for d in data:
            writer.writerow([_ for _ in d]) 
开发者ID:mlouielu,项目名称:twstock,代码行数:10,代码来源:fetch.py


示例20: egest

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def egest(self, *, image_detections, root):
        images_dir = f"{root}/training/image_2"
        os.makedirs(images_dir, exist_ok=True)
        labels_dir = f"{root}/training/label_2"
        os.makedirs(labels_dir, exist_ok=True)
        id_file = f"{root}/train.txt"
        for image_detection in image_detections:
            image = image_detection['image']
            image_id = image['id']
            src_extension = image['path'].split('.')[-1]
            shutil.copyfile(image['path'], f"{images_dir}/{image_id}.{src_extension}")
            with open(id_file, 'a') as out_image_index_file:
                out_image_index_file.write(f'{image_id}\n')
            out_labels_path = f"{labels_dir}/{image_id}.txt"
            with open(out_labels_path, 'w') as csvfile:
                csvwriter = csv.writer(csvfile, delimiter=' ', quoting=csv.QUOTE_MINIMAL)
                for detection in image_detection['detections']:
                    kitti_row = [-1] * 15
                    kitti_row[0] = detection['label']
                    kitti_row[1] = DEFAULT_TRUNCATED
                    kitti_row[2] = DEFAULT_OCCLUDED
                    x1 = detection['left']
                    x2 = detection['right']
                    y1 = detection['top']
                    y2 = detection['bottom']
                    kitti_row[4:8] = x1, y1, x2, y2
                    csvwriter.writerow(kitti_row) 
开发者ID:umautobots,项目名称:vod-converter,代码行数:34,代码来源:kitti.py


示例21: handle

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def handle(self, *args, **options):
    documents = Document.objects.all()#filter(verified=True)
    with open('importes_raros.csv', 'wb') as csvfile:
      impwriter = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
      for doc in documents:
        form_entries = doc.form_entries.all()
        form_fields = doc.document_set.form.all()[0].fields.filter(verify=True)
        importes = {}
        for fe in form_entries:
          fe_to_dict = fe.to_dict()
          importes[fe.id] = fe_to_dict['answer_Importe total']
        # report on documents with weird numbers
        encontrado = False
        for val in importes.values():
          comparar_a = importes.values()
          comparar_a.remove(val)
          for i in comparar_a:
            if re.findall(val.split('.')[0], i) and (val <> i):
              encontrado = True
        if encontrado:
          impwriter.writerow([doc.id, importes]) 
开发者ID:crowdata,项目名称:crowdata,代码行数:28,代码来源:report_on_imports.py


示例22: handle

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def handle(self, *args, **options):
    documents = Document.objects.all()#filter(verified=True)
    with open('importes_raros.csv', 'wb') as csvfile:
      impwriter = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
      # report on documents validated more than once
      for doc in documents:
        form_entries = doc.form_entries.all()
        form_fields = doc.document_set.form.all()[0].fields.filter(verify=True)
        #print "######### For Doc %s" % doc.id
        if len(form_entries) > 2:
          #print "Size on entries: %s" % len(form_entries)
          verified_entry_count = 0
          importes = {}
          for fe in form_entries:
            fe_to_dict = fe.to_dict()
            #print "-------- For entry user %s." % fe_to_dict['username']
            if fe_to_dict['answer_Adjudicatario_verified'] and \
            fe_to_dict['answer_Tipo de gasto_verified'] and \
            fe_to_dict['answer_Importe total_verified']:
              verified_entry_count += 1
            importes[fe.id] = fe_to_dict['answer_Importe total']
          if verified_entry_count > 1:
            print "The doc %s has more than one entry verified." % doc.id
          # report on documents with numbers weird
          encontrado = False
          for val in importes.values():
            comparar_a = importes.values()
            comparar_a.remove(val)
            for i in comparar_a:
              if re.findall(val.split('.')[0], i) and (val <> i):
                encontrado = True
          if encontrado:
            impwriter.writerow([doc.id, importes])
            #print "Doc %s, Importes %s." % (doc.id, importes) 
开发者ID:crowdata,项目名称:crowdata,代码行数:41,代码来源:reports_on_entries.py


示例23: main

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def main():
    args = parser.parse_args()
    rows = []
    for font in args.font:
        ttfont = ttLib.TTFont(font)
        for name in ttfont['name'].names:
            if name.nameID != NAMEID_COPYRIGHT_NOTICE:
                continue
            value = name.string.decode(name.getEncoding()) or ''
            rows.append([os.path.basename(font),
                         value,
                         len(value),
                         "{} ({})".format(
                             name.platformID,
                             PLATID_STR.get(name.platformID, "?"))])
    header = ['filename', 'copyright notice', 'char length', 'platformID']
    def as_csv(rows):
        import csv
        import sys
        writer = csv.writer(sys.stdout,
                            delimiter='|',
                            quotechar='"',
                            quoting=csv.QUOTE_MINIMAL)
        writer.writerows([header])
        writer.writerows(rows)
        sys.exit(0)
    if args.csv:
        as_csv(rows)
    print("") #some spacing
    print(tabulate.tabulate(rows, header, tablefmt="pipe"))
    print("") #some spacing 
开发者ID:googlefonts,项目名称:gftools,代码行数:39,代码来源:gftools-check-copyright-notices.py


示例24: dump_csv

# 需要导入模块: import csv [as 别名]
# 或者: from csv import QUOTE_MINIMAL [as 别名]
def dump_csv(query, file_or_name, include_header=True, close_file=True,
             append=True, csv_writer=None):
    """
    Create a CSV dump of a query.
    """
    if isinstance(file_or_name, basestring):
        fh = open(file_or_name, append and 'a' or 'w')
    else:
        fh = file_or_name
        if append:
            fh.seek(0, 2)
    writer = csv_writer or csv.writer(
        fh,
        delimiter=',',
        quotechar='"',
        quoting=csv.QUOTE_MINIMAL)
    if include_header:
        header = []
        for idx, node in enumerate(query._select):
            if node._alias:
                header.append(node._alias)
            elif isinstance(node, (Field, Func)):
                header.append(node.name)
            else:
                header.append('col_%s' % idx)
        writer.writerow(header)
    for row in query.tuples().iterator():
        writer.writerow(row)
    if close_file:
        fh.close()
    return fh 
开发者ID:danielecook,项目名称:Quiver-alfred,代码行数:37,代码来源:csv_utils.py



注:本文中的csv.QUOTE_MINIMAL属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。