473,799 Members | 3,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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 1452
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.cop ytree)

(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***@lazaridi s.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.cop ytree)

....

this one was helpfull.

thanks a lot.

..

--
http://lazaridis.com
Mar 21 '06 #4
Ed Singleton wrote:
On 21/03/06, Ilias Lazaridis <il***@lazaridi s.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.pytho n, Ilias
Lazaridis <il***@lazaridi s.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...definitel y 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
2712
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 not that different. I did like the indent-as-group idea, which was different. Ruby looked very cool. But it was impossible to get good documentation. It seemed like a Japanese cult with a few western initiates. Well, MacOS X ships with Perl,...
6
1898
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 look similar to C/C++ and Java. In the book, the author imported other modules that were from the standard library of Python. I tried reading some of the modules in the standard library in Python's Lib folder. I'm just a beginner to Python, and didn't...
114
9890
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
8324
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= fNew.writelines(lNew) fNew.close()
242
13464
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 comments on past experience, research articles, comments on the matter would be much appreciated. I suspect something like C would be the best based on comments I received from the VB news group. Thanks for the help in advance James Cameron
20
4085
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: li=;
232
13360
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 set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
52
3104
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 these examples should conform to PEP-8's style recommendations, including use of lower_case_with_underscores style for function names. I raised some questions about this suggestion, since I liked the names the way they were, but as a result, part...
22
1278
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 loop, and continue the list. Steve. ----------------------------------- for dev in devs try:
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9538
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7561
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.