[CODE] - Python Newcomer Starting with Coding

I

Ilias Lazaridis

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.

..
 
B

bruno at modulix

Ilias said:
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.

???
 
E

Ed Singleton

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
 
I

Ilias Lazaridis

Ed said:
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.
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.

..
 
M

Michael Tobis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top