Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76182

Re: newbee

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'programmer': 0.03; 'omit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'systems.': 0.12; '"hello': 0.16; 'command:': 0.16; 'editor,': 0.16; 'program?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'reload': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'acquired': 0.19; 'written,': 0.19; 'written': 0.21; '(the': 0.22; 'command': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script.': 0.24; 'environment': 0.24; "i've": 0.25; 'script': 0.25; 'shown': 0.26; 'header:X-Complaints-To:1': 0.27; 'thus': 0.29; "doesn't": 0.30; 'invoke': 0.31; 'probably': 0.32; 'run': 0.32; 'text': 0.33; 'linux': 0.33; 'skip:# 10': 0.33; 'something': 0.35; 'editor': 0.35; 'but': 0.35; 'controls': 0.36; 'shows': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'system,': 0.38; 'to:addr:python-list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'how': 0.40; 'simple': 0.61; 'first': 0.61; 'back': 0.62; 'save': 0.62; 'world': 0.66; 'due': 0.66; 'between': 0.67; 'frank': 0.68; 'ont': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: newbee
Date Wed, 13 Aug 2014 11:57:51 +0200
Organization None
References <CABhGeYW+Na5uhQ6Bdm31Vy2JU6JG_us3LHnz+a41WDCHyFUvrQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bdb2d6.dip0.t-ipconnect.de
User-Agent KNode/4.13.2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12916.1407923891.18130.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407923891 news.xs4all.nl 2868 [2001:888:2000:d::a6]:33636
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76182

Show key headers only | View raw


Frank Scafidi wrote:

> I just acquired a Raspberry Pi and want to program in Python. I was a PL/1
> programmer back in the 60's & 70's and Python is similar. I am struggling
> with some very fundamental things that I am not finding in the
> documentation. Can someone help me with the basics like how do I save a
> program I've written, reload it in Python, list the program once it's
> loaded? How do I edit a program? Are these command line functions?

You can use any text editor to write a python script. A simple editor which 
might be present ont the Pi is called "nano". It shows the hotkeys to store 
the text and quit the editor, and thus should be self-explanatory:

$ nano helloworld.py

Once you have written your simple script you can look at it with the "cat" 
command:

$ cat helloworld.py 
#!/usr/bin/env python
print "Hello world"

Invoke it with:

$ python helloworld.py 
Hello world

You can also make your script "executable" which means that the first line 
controls which program is used to run it:

$ chmod +x helloworld.py 
$ ./helloworld.py 
Hello world
$

If the script is in a directory listed in the PATH environment variable you 
can omit the path (the "./" in the above example):

$ mv helloworld.py ~/bin
$ helloworld.py 
Hello world

PS: I ran the above demo on a Linux system, but not on the Raspberry Pi, so 
if something doesn't work as shown above it's probably due to the difference 
between the two systems.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: newbee Peter Otten <__peter__@web.de> - 2014-08-13 11:57 +0200
  Re: newbee Duncan Booth <duncan.booth@invalid.invalid> - 2014-08-13 10:59 +0000

csiph-web