今天碰到个需求,根据字段个数,动态生成sql的占位符,如下: public static void main(String[] args) { System.out.println(String.join(",",Collections.nCopies(10,"?"))); } 显示结果: 来个实际的例子: public class Test { public static void main(String[] args) { String tableName =…
#coding:utf-8 import random import string import MySQLdb def gen_charint(filename, width =4, num=5): f = open(filename, 'wb') charint = string.digits + string.letters for i in range(num): verify = [random.choice(charint) for j in range(width)] verify…