{"id":1383,"date":"2017-12-17T21:10:19","date_gmt":"2017-12-17T12:10:19","guid":{"rendered":"http:\/\/www.python.ambitious-engineer.com\/?p=1383"},"modified":"2017-12-18T20:28:50","modified_gmt":"2017-12-18T11:28:50","slug":"%e3%83%a9%e3%83%b3%e3%83%80%e3%83%a0%e6%96%87%e5%ad%97%e5%88%97%e3%82%92%e7%94%9f%e6%88%90%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.python.ambitious-engineer.com\/archives\/1383","title":{"rendered":"\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u3092\u751f\u6210\u3059\u308b"},"content":{"rendered":"<p>\u521d\u671f\u30d1\u30b9\u30ef\u30fc\u30c9\u3084\u30c8\u30fc\u30af\u30f3\u3067\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u3092\u751f\u6210\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001Python3.6\u4ee5\u964d\u306e\u5834\u5408\u3001\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30ebrandom\u306echoices\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u7c21\u5358\u306b\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u30023.6\u3088\u308a\u53e4\u3044\u5834\u5408\u306f\u5c11\u3057\u5de5\u592b\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>random.choices\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u308b\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u751f\u6210(Python3.6\u4ee5\u964d)<\/h2>\n<p>random.choices\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u91cd\u8907\u3042\u308a\u3067\u6307\u5b9a\u3057\u305f\u500b\u6570\u5206\u3001\u30e9\u30f3\u30c0\u30e0\u306b\u8981\u7d20\u3092\u629c\u304d\u51fa\u3057\u307e\u3059\u3002python\u306e\u6587\u5b57\u5217\u306f\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059\u306e\u3067\u3001ascii\u6587\u5b57\u5217\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u306a5\u6587\u5b57\u3092\u5f97\u308b\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002k\u3067\u629c\u304d\u51fa\u3059\u6587\u5b57\u65705\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport random\r\nletters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\r\nrandom.choices(letters, k=5)\r\n#  ['R', 'n', 'J', 'T', 'k']\r\n# \r\n<\/pre>\n<p>\u3042\u3068\u306f\u3001join\u3067\u7d50\u5408\u3059\u308c\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u3002\u307e\u305f\u3001ascii\u6587\u5b57\u5217\u30bb\u30c3\u30c8\u306b\u3064\u3044\u3066\u306fstring\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport random\r\nimport string\r\n\r\n# ascii\u6587\u5b57\u5217\u3067\u751f\u6210\u3059\u308b\u5834\u5408\r\n''.join(random.choices(string.ascii_letters, k=5))\r\n#  'WQmEL'\r\n#\r\n\r\n# ascii\u3068\u6570\u5b57\u3067\u751f\u6210\u3059\u308b\u5834\u5408\r\n''.join(random.choices(string.ascii_letters + string.digits, k=5))\r\n# 'T67lZ'\r\n#  \r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>random.choice\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u308b\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u751f\u6210(Python3.6\u3088\u308a\u524d)<\/h2>\n<p>3.6\u3088\u308a\u53e4\u3044\u5834\u5408\u306f\u3001randome.choice\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002randome.choice\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u306b\u8981\u7d20\u3092\uff11\u3064\u629c\u304d\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport random\r\nletters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\r\nrandom.choice(letters)\r\n# 'b'\r\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u901a\u308a\u3001<a href=\"http:\/\/www.python.ambitious-engineer.com\/archives\/154\">\u30ea\u30b9\u30c8\u5185\u5305\u8868\u8a18<\/a>\u3092\u4f7f\u7528\u3059\u308b\u3068\u30013.6\u7cfb\u3067\u63d0\u4f9b\u3055\u308c\u305frandom.choices\u30e1\u30bd\u30c3\u30c9\u3068\u540c\u7b49\u306e\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport random\r\nletters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\r\n[random.choice(letters) for _ in range(5)]\r\n#  ['s', 'O', 'G', 'm', 'v']\r\n# \r\n<\/pre>\n<p>for\u5185\u306e\u5909\u6570\u306f\u4f7f\u7528\u3057\u306a\u3044\u305f\u3081\u3001\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u3042\u3068\u306fjoin\u3067\u7d50\u5408\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002\u4e0a\u3068\u540c\u69d8\u306bascii\u6587\u5b57\u5217\u30bb\u30c3\u30c8\u306b\u3064\u3044\u3066\u306fstring\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport random\r\nimport string\r\n\r\n# ascii\u6587\u5b57\u5217\u3067\u751f\u6210\u3059\u308b\u5834\u5408\r\n''.join([random.choice(letters) for _ in range(5)])\r\n#  'QMhgc'\r\n#\r\n\r\n# ascii\u3068\u6570\u5b57\u3067\u751f\u6210\u3059\u308b\u5834\u5408\r\n''.join([random.choice(letters) for _ in range(5)])\r\n# 'Akshe'\r\n#  \r\n<\/pre>\n<p>\u30ea\u30b9\u30c8\u5185\u5305\u8868\u8a18\u3092\u4f7f\u7528\u3059\u308b\u5206\u3072\u3068\u624b\u9593\u5897\u3048\u307e\u3059\u306d\u3002<br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u671f\u30d1\u30b9\u30ef\u30fc\u30c9\u3084\u30c8\u30fc\u30af\u30f3\u3067\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u3092\u751f\u6210\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001Python3.6\u4ee5\u964d\u306e\u5834\u5408\u3001\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30ebrandom\u306echoices\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u7c21\u5358\u306b\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u30023....<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1383"}],"collection":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/comments?post=1383"}],"version-history":[{"count":6,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1383\/revisions"}],"predecessor-version":[{"id":1392,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1383\/revisions\/1392"}],"wp:attachment":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media?parent=1383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/categories?post=1383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/tags?post=1383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}