Using linux and Python 2.6, learning how to work with files from a Windows
oriented textbook:
This works:
infile=open('/foo/bar/prog/py_modules/this_is_a_test','r')
This doesn't:
infile=open('~/prog/py_modules/this_is_a_test','r')
Can't I work with files using Unix expressions?
--
http://mail.
Thanks for your responses to my student question about using OS paths in
Python.
For the more general case, I am a Linux user interested in making my scripts
platform neutral, which would include Linux, Unix (including Mac), and
Windows. I have looked at the python.org os segment and didn't ge
I have been a desktop Linux user for better than eleven years, as a hobby.
Back when we still did most of our computing on desktops I even set up a
rudimentary server setup in my home. Nothing fancy or anything, but I was
proud of it and of the fact that it was built Microsoft free. I have no
On Tuesday, September 13, 2011 01:37:05 pm Thomas Jollans wrote:
> On 13/09/11 22:25, Tim Hanson wrote:
> > I have been a desktop Linux user for better than eleven years, as a
> > hobby. Back when we still did most of our computing on desktops I even
> > set up a rudimenta
On Tuesday, September 13, 2011 01:37:05 pm Thomas Jollans wrote:
> On 13/09/11 22:25, Tim Hanson wrote:
> > I have been a desktop Linux user for better than eleven years, as a
> > hobby. Back when we still did most of our computing on desktops I even
> > set up a rudimenta
On Tuesday, September 13, 2011 02:36:52 pm Christian Heimes wrote:
> Am 13.09.2011 22:52, schrieb Tim Hanson:
> > That's not a bad idea. From the past I know that bug fixing is a great
> > way to learn a language. If you know a specific site to key in on, feel
>
On Tuesday, September 13, 2011 06:12:27 pm Terry Reedy wrote:
> >> It's a great idea. We are always looking for volunteers that help the
> >> community to reduce the amount of open bugs. The bug tracker at
> >> http://bugs.python.org/ even has a category for beginners. You just have
> >> to search
I am to the point in _Learning_Python_ where functions are introduced.
I decided to experiment by putting a function into a file and importing it
into Idle. Of course, Idle couldn't find it, so I executed the following
command in Bash:
PYTHONPATH=/home/foo/prog/learning_python
export PYTHONP
Okay, I solved my problem with Python finding modules:
I put the following into a file in my home directory, on the good advice of
Andrea Crotti:
import sys
sys.path.append('/home/foo/mypath'
I named the file "~/pypath.py", so now, in idle:
import pypath
No errors.
I'm still getting a little
I feel a little silly. I am learning Python by reading _Learning_Python_ by
Mark Lutz. I made it all the way to "Hello World" before my first question.
:-)
The program isn't too complicated.
print "Hello World"
print 2**100
I saved it to a directory for which I have rw permissions that I move
10 matches
Mail list logo