# import random
# for x in range(10):
# i = 0
# l = []
# while i < 10:
# ret = chr(random.randint(33, 126))
# if ret not in ['/','\\','@','I','l','o','O']:
# i+=1
# l.append(ret)
# print(''.join(l)) import random
import string
for x in range(10):
str_source = string.ascii_letters + string.digits + string.punctuation
str_list = random.sample(str_source,7)
if str_list not in ['/','\\','@','I','l','o','O']:
str_final = ''.join(str_list)
print(str_final)

random 随机生成字符串的更多相关文章

  1. c# .Net随机生成字符串代码

    /// <summary> /// 随机生成字符串 /// </summary> /// <param name="OperationType"> ...

  2. java Random随机生成一个数

    package java05; import java.util.Random; /* Random随机生成一个数字 1.导包: import java.util.Random; 2.创建 Rando ...

  3. RandomStringUtils工具类(java随机生成字符串)

    使用RandomStringUtils可以选择生成随机字符串,可以是全字母,全数字,自定义生成字符等等... 其最基础的方法: 参数解读: count:需要生成的随机串位数 letters:只要字母 ...

  4. java中随机生成字符串的方法(三种)

    org.apache.commons.lang(2.6): 链接:https://pan.baidu.com/s/1k_oeA5AjSt6evoR7zT8gpQ 提取码:yhl5 1.生成的字符串每个 ...

  5. ruby随机生成字符串

    随机生成一个固定位数的字符串: def newpass( len ) chars = (").to_a newpass = "" 1.upto(len) { |i| ne ...

  6. java随机生成字符串(字符随机生成类 生成随机字符组合)

    原文:http://www.jb51.net/article/45006.htm package p2p_web; import java.util.ArrayList; import java.ut ...

  7. Shell随机生成字符串

    随机生成18位的字符串,数字 大小写字符 斜线 password=`openssl rand -base64 |-`

  8. java随机生成字符串工具类

    package aA; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; /** * 字符随机 ...

  9. java随机生成字符串和校验

    首先定义字符串 String a = "0123456789"; // 数字 String b = "abcdefghijklmnopqrstuvwxyz"; ...

随机推荐

  1. 中文分词工具jieba中的词性类型

    jieba为自然语言语言中常用工具包,jieba具有对分词的词性进行标注的功能,词性类别如下: Ag 形语素 形容词性语素.形容词代码为 a,语素代码g前面置以A. a 形容词 取英语形容词 adje ...

  2. react-native init安装指定版本的react-native

    C:\Users\ZHONGZHENHUA\imooc_gp\index.js index.js /** @format */ import React,{ Component } from 'rea ...

  3. centos6 安装 docker

    一.升级内核(带aufs模块) 1.yum安装带aufs模块的3.10内核(或到这里下载kernel手动安装:http://down.51cto.com/data/1903250) cd /etc/y ...

  4. Opencv Harris角点检测

    #include <iostream>#include <opencv2/opencv.hpp> using namespace std;using namespace cv; ...

  5. 2-R型聚类

    将相似的属性聚合在一起 clc, clear; % a = load('E:\a-建模\<数学建模算法与应用>课件资源\数学建模算法与应用\程序及数据\10第10章\gj.txt'); a ...

  6. 修改ubuntu密码

    https://www.linuxidc.com/Linux/2016-05/131256.htm

  7. hdu Lovekey(水题)

    #include<stdio.h> #include<string.h> ]; int main() { ],s2[]; int l1,l2,i,j,k; while(scan ...

  8. 视觉SLAM实战(一):RGB-D SLAM V2

    写在前面 首先打个广告.SLAM研究者交流QQ群:254787961.欢迎各路大神和小白前来交流. 看了前面三篇博文之后,是不是有同学要问:博主你扯了那么多有用没用的东西,能不能再给力一点,拿出一个我 ...

  9. 使用 console.time() 计算js代码执行时间

    console.time('hellor'); for(var i=0;i<100000;i++){} console.timeEnd('hellor');

  10. Eclipse下配置主题颜色

    插件地址  http://eclipse-color-theme.github.com/update 安装之后 下载安装好之后,点击window -> preferences -> Gen ...