{"id":901,"date":"2013-01-11T17:04:13","date_gmt":"2013-01-11T17:04:13","guid":{"rendered":"https:\/\/www.phillips321.co.uk:443\/?p=901"},"modified":"2013-01-11T17:04:13","modified_gmt":"2013-01-11T17:04:13","slug":"python-tab-completion","status":"publish","type":"post","link":"https:\/\/www.phillips321.co.uk\/2013\/01\/11\/python-tab-completion\/","title":{"rendered":"python tab completion"},"content":{"rendered":"<p>So I&#8217;ve slowly been working my way through Security Tubes Python Scripting Expert (SPSE) course. But, I&#8217;ve not liked the way the python interpreter doesn&#8217;t have tab completion. After a little bit of digging I found the following so wanted to make sure I made a note of it and shared it with others.<\/p>\n<p>Create a file in your home directory called <em>.pyrc<\/em> and insert the following lines into it:<\/p>\n<div class=\"codecolorer-container python vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"python codecolorer\"><span class=\"kw1\">import<\/span> <span class=\"kw3\">rlcompleter<\/span><span class=\"sy0\">,<\/span> <span class=\"kw3\">readline<\/span><br \/>\n<span class=\"kw3\">readline<\/span>.<span class=\"me1\">parse_and_bind<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;tab: complete&quot;<\/span><span class=\"br0\">&#41;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Now you need to ensure that this file is pulled into python each time it run, add the following to your <em>.bashrc<\/em> file:<\/p>\n<div class=\"codecolorer-container text vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">export PYTHONSTARTUP=&quot;${HOME}\/.pyrc&quot;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Activate the changes in your current terminal and you&#8217;re sorted.<\/p>\n<div class=\"codecolorer-container text vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">source ${HOME}\/.bashrc<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;ve slowly been working my way through Security Tubes Python Scripting Expert (SPSE) course. But, I&#8217;ve not liked the way the python interpreter doesn&#8217;t have tab completion. After a little bit of digging I found the following so wanted to make sure I made a note of it and shared it with others. Create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[341,342,111,340],"_links":{"self":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/901"}],"collection":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/comments?post=901"}],"version-history":[{"count":2,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/901\/revisions"}],"predecessor-version":[{"id":903,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/901\/revisions\/903"}],"wp:attachment":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/media?parent=901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/categories?post=901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/tags?post=901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}