473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

[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 1435
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wayne Folta | last post by:
I've been a long-time Perl programmer, though I've not used a boatload of packages nor much of the tacky OO. A couple of years ago, I decided to look into Python and Ruby. Python looked OK, but...
6
by: Hung ho | last post by:
Hi. I just finished reading an introductory Python book called "Python Programming for the absolute beginner" by Michael Dawson. I found it very interesting, and easy to follow. Python does really...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
6
by: qwweeeit | last post by:
Hi all, when I was young I programmed in an interpreted language that allowed to modify itself. Also Python can (writing and running a module, in-line): fNew =open("newModule.py",'w') lNew=...
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
20
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: ...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
52
by: Paul McGuire | last post by:
I'm starting a new thread for this topic, so as not to hijack the one started by Steve Howell's excellent post titled "ten small Python programs". In that thread, there was a suggestion that...
22
by: bambam | last post by:
I have about 30 pages (10 * 3 pages each) of code like this (following). Can anyone suggest a more compact way to code the exception handling? If there is an exception, I need to continue the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.