469,964 Members | 1,809 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

[CODE] - Python Newcomer Starting with Coding

Where can I find practical coding examples for real life coding problems?

Something like a categorized solution guide?

-

My current problem:

* create a folder
* seems to be: os.mkdir(path)

* obtain the path of a python package

* copy the content of the package folder to the created folder

alternatively (which would possibly preserve the file-attributes)

* obtain the path of a python package

* copy the content of the package folder to the destination folder,
whlist giving a new name.

I've looked in the Python 2.4 documentation, but the resulting
possibilities are too much.

Any suggestions welcome.

..

--
http://lazaridis.com
Mar 21 '06 #1
8 1268
Ilias Lazaridis wrote:
Where can I find practical coding examples for real life coding problems?
Probably in real life code ?-)
Something like a categorized solution guide?
Look for the Python cookbook (google is your friend).
-

My current problem:

* create a folder
* seems to be: os.mkdir(path)
I wouldn't even count this as a coding problem, except perhaps for a
total CS newbie.
* obtain the path of a python package
import package
print package.__file__
* copy the content of the package folder to the created folder
import shutil
help(shutil.copytree)

(snip)
I've looked in the Python 2.4 documentation, but the resulting
possibilities are too much.


???
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Mar 21 '06 #2
On 21/03/06, Ilias Lazaridis <il***@lazaridis.com> wrote:
Where can I find practical coding examples for real life coding problems?

Something like a categorized solution guide?

This sounds quite a lot like PLEAC. It certainly contains a lot that
you would find useful.

http://pleac.sourceforge.net/pleac_python/index.html

Also, try using the python-tutor list. It's a lot more helpful for
questions like these.

My current problem:

* create a folder
* seems to be: os.mkdir(path)


Try using the Path module. It makes all that stuff much easier:

http://www.jorendorff.com/articles/python/path/

Ed
Mar 21 '06 #3
bruno at modulix wrote:
Ilias Lazaridis wrote:
Where can I find practical coding examples for real life coding problems?


Probably in real life code ?-)
Something like a categorized solution guide?


Look for the Python cookbook (google is your friend).

....

http://www.oreilly.com/catalog/pythoncook/

sorry, I've not clarified that I mean an free internet resource.
* copy the content of the package folder to the created folder


import shutil
help(shutil.copytree)

....

this one was helpfull.

thanks a lot.

..

--
http://lazaridis.com
Mar 21 '06 #4
Ed Singleton wrote:
On 21/03/06, Ilias Lazaridis <il***@lazaridis.com> wrote:
Where can I find practical coding examples for real life coding problems?

Something like a categorized solution guide?

This sounds quite a lot like PLEAC. It certainly contains a lot that
you would find useful.

http://pleac.sourceforge.net/pleac_python/index.html


yes, this looks like the resource I was looking for.
Also, try using the python-tutor list. It's a lot more helpful for
questions like these.


I've subscribed via gmane's nntp:

news://news.gmane.org:119/gmane.comp.python.tutor

will take a close look to this list.
My current problem:

* create a folder
* seems to be: os.mkdir(path)


Try using the Path module. It makes all that stuff much easier:

http://www.jorendorff.com/articles/python/path/


looks very intresting.

for now I am limited to the standard library.

but I will for sure take a deeper look in near future.

..

--
http://lazaridis.com
Mar 21 '06 #5
On Tue, 21 Mar 2006 20:05:48 +0200 in comp.lang.python, Ilias
Lazaridis <il***@lazaridis.com> wrote:
bruno at modulix wrote:

[...]
Look for the Python cookbook (google is your friend).

...

http://www.oreilly.com/catalog/pythoncook/

sorry, I've not clarified that I mean an free internet resource.


Try the first hit from google rather than the third.

http://aspn.activestate.com/ASPN/Python/Cookbook/

Regards,
-=Dave

--
Change is inevitable, progress is not.
Mar 21 '06 #6
And there's always Mark Pilgrim's very good and very free "Dive Into
Python".
http://www.diveintopython.org/

Mar 21 '06 #7
Are you sure this is what you want to do? It seems an odd objective for
a preliminary effort.

Forgive me if I am reading this wrong, but I am concerned that you
think you need to do all this work to use the package. If so, you are
asking the wrong questions. Please look into the PYTHONPATH environment
variable and the sys.path list within Python.

mt

Mar 21 '06 #8
Chris Lasher wrote:
And there's always Mark Pilgrim's very good and very free "Dive Into
Python".
http://www.diveintopython.org/


Reading that now...definitely not for a newbie.
Mar 21 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Wayne Folta | last post: by
114 posts views Thread by Maurice LING | last post: by
6 posts views Thread by qwweeeit | last post: by
242 posts views Thread by James Cameron | last post: by
20 posts views Thread by Xah Lee | last post: by
232 posts views Thread by robert maas, see http://tinyurl.com/uh3t | last post: by
52 posts views Thread by Paul McGuire | last post: by
22 posts views Thread by bambam | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.