LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2013, 01:22 PM   #1
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Rep: Reputation: 1
executing a python code


Hi,

I have installed a code which has been written by python. There in the tutorial, they have said to create a personal .pythonrc file:

Quote:
import rlcompleter
import readline
readline.parse_and_bind("tab: complete")
from ase import *
I am baffled since I know nothing about python. What does this mean?
 
Old 06-26-2013, 01:32 PM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
This may help you and it's free!
http://femhub.com/textbook-python/
jdk
 
Old 06-26-2013, 02:25 PM   #3
slipstreamed
Member
 
Registered: Nov 2010
Posts: 57

Rep: Reputation: 24
A .pythonrc file is executed when the Python interactive shell is started, if
$PYTHONSTARTUP is in your environment and points to this file. In order for the Python shell to run your pythonrc.py file on startup you need to set the PYTHONSTARTUP environment variable. Place the following line in one of your shell startup files:

Code:
export PYTHONSTARTUP=$HOME/.pythonrc.py
Code:
import rlcompleter
import readline
---> The rlcompleter module defines a completion function suitable for the readline module by completing valid Python identifiers and keywords, rlcompleter adds tab-completion for Python symbols to the interactive interpreter. Importing the module causes it to configure a completer function for readline. The only other step required is to configure the tab key to trigger the completer. Simply put this module provides word completion for python keywords, identifiers using the tab key.
The statement
Code:
readline.parse_and_bind("tab: complete")
binds the tab key on your keyboard so you can hit tab for auto-completion of python keywords, identifiers, a standard feature found in almost all IDEs.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help executing shell commands in a Python script zippy4251 Programming 7 09-25-2012 12:20 PM
executing an external command with Python (CGI) laurapt Programming 1 07-08-2011 12:18 PM
executing C++ code from within PHP code vineet7kumar Programming 1 06-03-2007 05:13 PM
Crawling a directory and executing Python functions. Travis86 Programming 2 07-06-2005 02:06 AM
python, executing regular linux commands Robert0380 Programming 3 06-26-2003 04:35 PM


All times are GMT -5. The time now is 04:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration