On Mon, 7 Mar 2011 06:54:30 pm vineeth wrote:
Hello all I am doing some analysis on my trace file. I am finding the
lines Recvd-Content and Published-Content. I am able to find those
lines but the re module as predicted just gives the word that is
being searched. But I require the entire line
michael scott jigenbak...@yahoo.com wrote
...if something about my code could be better, please tell me,
OK, Here are some stylistic things...
def production_time():
creation_time = 127
time_till_rest = 18161
I'd move the constants out of the function to global level.
And it is
Modulok modu...@gmail.com wrote
However, to make all of your numbers line up nicely, regardless of
how
long they are, you need to look into advanced string formatting via
the builtin string method 'format()'. It takes a little practice
Or, if your version of Python doesn't support
Modulok wrote:
Notice that 'd' in your string substitution means integers, not
floats. Any decimal places will be truncated when using 'd'. For
floats use 'f' instead. You an also specify a precision, such as
'%.2f' shows two decimal places.
However, to make all of your numbers line up nicely,
I know that the question has long been answered (and probably due today), but I
solved it and it was great exercise for me (as I'm not in college at the moment
and I need assignments like these to gauge my skills). I'll probably build a
gui
for it tomorrow, just so I can practice at that. I
On 3/4/11, lea-par...@bigpond.com lea-par...@bigpond.com wrote:
Hello
I have created the following code but would like the program to include two
decimal places in the amounts displayed to the user. How can I add this?
My code:
# Ask user to enter purchase price
purchasePrice = input
Am 03.03.2011 22:28, schrieb Andrew Bouchot:
okay so this is my comp sci lab
*
Problem:
*ProductionTime.py It takes exactly 2 minutes and 7 second to produce an
item. Unfortunately, after 143 items are produced, the fabricator must
cool off for 5 minutes and 13 seconds before it can continue.
This isn't so much as a python problem as it is a simple math problem, and I
feel you are being lazy, but in the offchance you're having problems with
the '/' operator:
cooloff = (numitems/143)*313
total = cooloff + seconds
I think you are using python 2.6 (and I guess 2.7) or older based on
On Thu, Mar 3, 2011 at 4:56 PM, Knacktus knack...@googlemail.com wrote:
Am 03.03.2011 22:28, schrieb Andrew Bouchot:
okay so this is my comp sci lab
*
Problem:
*ProductionTime.py It takes exactly 2 minutes and 7 second to produce an
item. Unfortunately, after 143 items are produced, the
James Reynolds wrote:
[...]
You are almost assuredly going to get flamed for not having a descriptive
title and for asking what is obviously homework questions
At least Andrew did the right thing by being honest that it was a
homework question, and by showing the work he's done so far.
But
instead of input ... use raw_input()
On Thu, Feb 24, 2011 at 9:45 AM, Chris Schiro cschiro...@gmail.com wrote:
Hi,
I am completely new to programming aside from working with basic many years
ago. I purchased a Python book for beginners so I could start from scratch
which has been walking
I have found that this line will return an error every time while running
the completed program, unless I enter a number. If I enter a numeric value
the program will continue on as written.
When it comes to things like error messages, you need to post enough
code and the _exact_ error message
On Thu, Feb 24, 2011 at 5:15 AM, Chris Schiro cschiro...@gmail.com wrote:
Hi,
I am completely new to programming aside from working with basic many years
ago. I purchased a Python book for beginners so I could start from scratch
which has been walking me through just fine until: writing a
On 2/24/11, Chris Schiro cschiro...@gmail.com wrote:
Hi,
I am completely new to programming aside from working with basic many years
ago. I purchased a Python book for beginners so I could start from scratch
which has been walking me through just fine until: writing a program to
interact
That line only expects int and say numbers generally.
If you want to print strings, use, raw_input in place of input.
Try that out and then let's have a feedback.
Sent from my BlackBerry wireless device from MTN
On Thu, Feb 24, 2011 at 9:53 AM, Nitin Pawar nitinpawar...@gmail.comwrote:
instead
Chris Schiro cschiro...@gmail.com wrote
I am completely new to programming aside from working with basic
many years
ago. I purchased a Python book for beginners so I could start from
scratch
which has been walking me through just fine until: writing a program
to
interact with user for
i can mail free books on python 2. if you want.
starting out with python 3.XXX restricts the amount of help you can get and
also free resources.
most resources i have come across are python 2.XXX.
cheers.
On Thu, Feb 24, 2011 at 9:58 AM, Andre Engels andreeng...@gmail.com wrote:
On Thu, Feb
Request:
When posting a question use a meaningful subject line, as some of us
track email by subject.
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
On 24 February 2011 14:52, pyhx0r pyh...@gmail.com wrote:
*Why do in my code, it loops to all values and not in Mark Pilgrim’s code?
*
Because in Mark's code the loop is terminated by the return statement
(contained in the utility function approximate_size().) In your code you've
removed the
On 01/-10/-28163 02:59 PM, pyhx0r wrote:
Dear All,
snip
multiple = 1024 if a_kilobyte_is_1024_bytes else 1000
for suffix in SUFFIXES[multiple]:
size /= multiple
if size multiple:
return '{0:.1f} {1}'.format(size, suffix)
snip
I’ve shorted the code
Dear All,
Thank you for your advise, it's helpful for me.
NB: To DaveA, It was copy-paste from my notepad so the indentation went
wrong :(
+---+--+---+
| py | h | x0r |
+---+--+---+
■ 1 3 0 E2 C 9 ■
___
Tutor maillist - Tutor@python.org
To
On 24 February 2011 16:22, Dave Angel da...@ieee.org wrote:
(Is there a reason you double-spaced all that code? It makes it very hard
to read, and quite difficult to quote, since I had to delete every other
line.)
For what it's worth the code came out perfectly fine on my email reader
On 02/24/2011 11:55 AM, Walter Prins wrote:
On 24 February 2011 16:22, Dave Angelda...@ieee.org wrote:
(Is there a reason you double-spaced all that code? It makes it very hard
to read, and quite difficult to quote, since I had to delete every other
line.)
For what it's worth the code
Sriram Jaju ramjaju.m...@gmail.com wrote
I'm new to python. I'm doing a project on OCR (Optical Character
Recognition), I've heard a lot about Python so i want to know
whether i can
use python for OCR.
That depends a lot on the environment. What OS will you be using?
What are you doing
Shashwat Anand anand.shash...@gmail.com wrote
My another doubt is that, can i use python for programming
microcontrollers
You bet.
Really? How would he go about that?
I've not seen (or even heard of) Python used in that role before.
Alan G
I'm using windows7. I'm doing a robotic project in which a robot has to take
instruction from images which are taken by camera.
image consists of characters like 'START', 'STOP' etc.
On Mon, Feb 7, 2011 at 2:25 PM, Alan Gauld alan.ga...@btinternet.comwrote:
Sriram Jaju ramjaju.m...@gmail.com
On Mon, Feb 7, 2011 at 1:13 PM, Sriram Jaju ramjaju.m...@gmail.com wrote:
Hi all,
I'm new to python. I'm doing a project on OCR (Optical Character
Recognition), I've heard a lot about Python so i want to know whether i can
use python for OCR.
If yes what are the tool require for that?.
ian douglas wrote:
It bugs me that so many people are quick to jump on the we wont' do
your homework bandwagon -- I was accused of the same thing when I
posted a question to the list myself. I've been programming
professionally for many years but learning Python in my spare time... I
sent
Hi Nevins, I don't think I've seen you post here before. Welcome to the
list!
Before answering your comment (see below), I have to give you a gentle
wrap on the knuckles. It's considered impolite to:
(1) reply to a digest without changing the subject line from Tutor
Digest to something more
On Wed, Feb 2, 2011 at 12:19 AM, Sean Carolan scaro...@gmail.com wrote:
I have a function that accepts four arguments, namely startmonth,
startyear, endmonth, and endyear. For example:
startmonth = 8
startyear = 2009
endmonth = 1
endyear = 2010
What would be the most straightforward way
Hugo Arts hugo.yo...@gmail.com wrote
What would be the most straightforward way to create a list of
year/month pairs from start to end? I want to end up with a list of
tuples like this:
mylist = [(2009, 8), (2009, 9), (2009, 10), (2009, 11), (2009, 12),
(2010, 1)]
That said, you can do
--- On Tue, 2/1/11, Sean Carolan scaro...@gmail.com wrote:
From: Sean Carolan scaro...@gmail.com
Subject: [Tutor] Help with range of months spanning across years
To: Tutor@python.org
Date: Tuesday, February 1, 2011, 6:19 PM
I have a function that accepts four
arguments, namely startmonth,
It bugs me that so many people are quick to jump on the we wont' do
your homework bandwagon -- I was accused of the same thing when I
posted a question to the list myself. I've been programming
professionally for many years but learning Python in my spare time... I
sent this reply to Sean
This sounds somewhat like homework. If it is, that's fine, mention it,
and we will help you. But we won't do your homework for you, so keep
that in mind.
A reasonable assumption but this is actually going in a cgi tool that
I'm using at work. The input comes from pull-down menus on a web
On Wed, Feb 2, 2011 at 2:30 AM, ian douglas ian.doug...@iandouglas.com wrote:
It bugs me that so many people are quick to jump on the we wont' do your
homework bandwagon -- I was accused of the same thing when I posted a
question to the list myself. I've been programming professionally for many
On Wed, Feb 2, 2011 at 2:55 AM, Sean Carolan scaro...@gmail.com wrote:
This sounds somewhat like homework. If it is, that's fine, mention it,
and we will help you. But we won't do your homework for you, so keep
that in mind.
A reasonable assumption but this is actually going in a cgi tool
As far as I can tell from quickly going through documentation, no. At
least, not with a quick and easy function. datetime can represent the
dates just fine, and you can add days to that until you hit your end
date, but adding months is harder. timedelta can't represent a month,
which makes
On Mon, Jan 24, 2011 at 11:25 AM, bsd...@gmail.com bsd...@gmail.com wrote:
Hi, hoping for some help here. I've been trying to write a python script
(complete newb) and have spent several days trying to get this right with no
success.
I am trying to list timestamps in a directory and if they
I would check that os.path.join(r,dir) is giving you the directory you
think it is.
- japhy
On Mon, Jan 24, 2011 at 12:25 PM, bsd...@gmail.com bsd...@gmail.com wrote:
Hi, hoping for some help here. I've been trying to write a python script
(complete newb) and have spent several days trying to
Hello,
Also working w/o external module just the standard one:
* import datetime
remove_after = datetime.datetime.now() - datetime.timedelta(days=31)
remove_after
datetime.datetime(2010, 12, 24, 23, 21, 10, 11315)
*
Regards
Karim
On 01/24/2011 08:02 PM, Vince Spicer wrote:
On Mon, Jan
it's a bug in your regex - you want something like -?\d+
- japhy
On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong tc...@hotmail.com wrote:
hi,
i have a set of data and using re to extract it into array. however i only
get positive value, how to extract the whole value including the -ve sign?
health, what have
the
Romans ever done for us?
~~
From: Steven D'Aprano st...@pearwood.info
To: tutor@python.org
Sent: Sun, January 23, 2011 4:10:35 AM
Subject: Re: [Tutor] Help on RE
tee chwee
thanks it works!! :)
Date: Sat, 22 Jan 2011 19:51:35 -0500
Subject: Re: [Tutor] Help on RE
From: ja...@pearachute.com
To: tc...@hotmail.com
CC: tutor@python.org
it's a bug in your regex - you want something like -?\d+
- japhy
On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong tc
thanks for making me understand more on re. re is a confusing topic as i'm
starting on python.
Date: Sat, 22 Jan 2011 16:55:37 -0800
From: st...@alchemy.com
To: tc...@hotmail.com
CC: tutor@python.org
Subject: Re: [Tutor] Help on RE
On Sun, Jan 23, 2011 at 12:38:10AM +, tee chwee
On Sun, Jan 23, 2011 at 12:38:10AM +, tee chwee liong wrote:
i have a set of data and using re to extract it into array. however i only
get positive value, how to extract the whole value including the -ve sign?
numbers = re.findall(\d+, line)
The \d matches a digit character. \d+
tee chwee liong wrote:
thanks for making me understand more on re. re is a confusing topic as i'm starting on python.
I quote the great Jamie Zawinski, a world-class programmer and hacker:
Some people, when confronted with a problem, think 'I know, I'll
use regular expressions. Now
elegant. :)
simple yet elegant.
Date: Sun, 23 Jan 2011 14:10:35 +1100
From: st...@pearwood.info
To: tutor@python.org
Subject: Re: [Tutor] Help on RE
tee chwee liong wrote:
thanks for making me understand more on re. re is a confusing topic as i'm
starting on python.
I quote
walter weston hacker0...@hotmail.com wrote
how comes when I run code from a new window in python
IDLE the text highlighting dissapears
No idea, it doesn't do that for me.
Can you be more specific about what you are doing.
Also which version of Python, which OS etc?
How exactly are you
I confess I don't know a lot about C so I may be off base here... But it looks
like your c func extendarray returns a pointer to the new extended array, but
you are not capturing this pointer in your python when you call the c func. So
the python code is pointing at the old deallocated array.
Robert Sjöblom robert.sjob...@gmail.com wrote
Why would you want to sum them? You start with 30 points in the
pool,
then allocate them to the attributes. The sum will still be 30.
Because the user should be able to spend 30 points, or remove points
from an attribute and get them back in the
On Mon, Nov 22, 2010 at 10:27 AM, tutor-requ...@python.org wrote:
Send Tutor mailing list submissions to
tu...@python.org
[snip]
Ok, I'm clearly thinking in circles here. I used the interpreter to
figure out that both are fine but the first example has integers,
whereas the second
On Mon, Nov 22, 2010 at 12:29 AM, Robert Sjöblom
robert.sjob...@gmail.com wrote:
Hi. I'm new at programming and, as some others on this list, am going
through Python Programming for the Absolute Beginner. In the current
chapter (dealing with lists and dictionaries), one of the challenges
is
[Snip]
I don't want a direct answer on how to proceed, but a question that
arose during my thinking of the problem was whether dictionaries can
have integral data in them, like so:
attributes = {Strength : 28, Health : 12}
or if they have to be:
attributes = {Strength : 28, Health : 12}
On 11/21/2010 6:29 PM, Robert Sjöblom wrote:
Hi. I'm new at programming and, as some others on this list, am going
through Python Programming for the Absolute Beginner. In the current
chapter (dealing with lists and dictionaries), one of the challenges
is to:
Write a Character Creator program
On Mon, Oct 11, 2010 at 6:56 AM, p4ddy prdpsb...@gmail.com wrote:
Hi,
I have a HLS Player written in python but whenever I try to install it, I
get this error
ImportError: No module named setuptools
So I downloaded setuptools-0.6c11.zip and tried to install it, again i got
this error
On Fri, 1 Oct 2010 09:26:16 am Russell Smith wrote:
I’m trying to put together a script using urllib2, smtplib and
stripogram/html2text which will use a healthcheck url, read the
response after loading it and then email me the results without any
unwanted html tags. I was able to do that but,
On Thu, 23 Sep 2010 03:17:39 pm ranjan das wrote:
What I want to do is write my code completely in Python (as gainst
iron python),
Iron Python *is* Python. It's just a different implementation, with
built-in support for Dot-Net.
copy it to the visual studio editor and create a web
based
On Wed, Sep 22, 2010 at 7:55 AM, ranjan das ranjand2...@gmail.com wrote:
Please Advise:
I need to run/execute python module in C#. I am using python 2.6 and
visual studio 10
You should check out IronPython
http://www.ironpython.com/
http://www.ironpython.com/HTH,
Wayne
Hi Wayne,
Thanks for your reply. The problem is a bit more specific. I have come
across ironpython and I ran a test file and it works fine as far as the
wrapping is concerned.
What I want to do is write my code completely in Python (as gainst iron
python), copy it to the visual studio editor and
On Sat, Sep 18, 2010 at 10:16 AM, Fernando Karpinski
fanger2...@gmail.comwrote:
Hi, everyone. I need help when importing a file I created, with the .py
extension. I am trying to access its directory in DOS, and after I do it, I
type import filename, but it is not working. I tried to do it
On Sun, 19 Sep 2010 12:16:47 am Fernando Karpinski wrote:
Hi, everyone. I need help when importing a file I created, with
the .py extension. I am trying to access its directory in DOS, and
after I do it, I type import filename, but it is not working.
Define not working.
My crystal ball
On Sat, Sep 18, 2010 at 11:46 AM, Steven D'Aprano st...@pearwood.info wrote:
On Sun, 19 Sep 2010 12:16:47 am Fernando Karpinski wrote:
Hi, everyone. I need help when importing a file I created, with
the .py extension. I am trying to access its directory in DOS, and
after I do it, I type
On Tue, Sep 14, 2010 at 8:00 PM, Ciera Jones cjo1...@gmail.com wrote:
Hi
When I enter myvar= raw_input (Please excuse a number of movies: )
and I try and convert it to an integer it gives me an error message.
I put in:
movietotal= int(myvar)* 3 and I get an error message
Ciera
post your
Ciera Jones cjo1...@gmail.com wrote
When I enter myvar= raw_input (Please excuse a number of movies: )
and I try and convert it to an integer it gives me an error message.
I put in:
movietotal= int(myvar)* 3 and I get an error message
Don't put quotes around the variable name.
Python is
On Mon, Aug 30, 2010 at 2:26 PM, Serdar Tumgoren tumgor...@washpost.com wrote:
I haven't read it yet myself, but the below book just came out:
http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=cm_cr_pr_sims_t
I'm not aware of any other book that focuses exclusively
On Mon, Aug 30, 2010 at 3:21 PM, Alan Gauld alan.ga...@btinternet.com wrote:
Tino Dai obe...@gmail.com wrote
I'm beefing up my Object-Oriented Analysis and Design - getting
the gaps in my
knowledge filled in through the Head First OOAD book
I don't know it although I've seen a couple
On Mon, Aug 30, 2010 at 2:59 PM, Knacktus knack...@googlemail.com wrote:
You could google for
1) Alex Martelli, Design Patterns
He's a Pyton guru and there're some online talks (at Google and some
conferences) about DP; a bit difficult to understand, well, he's guru ;-)
2)
To: Alan Gauld alan.ga...@btinternet.com
Cc: tutor@python.org
Sent: Tue, August 31, 2010 3:43:57 PM
Subject: Re: [Tutor] Help with Object Oriented Programming
On Mon, Aug 30, 2010 at 3:21 PM, Alan Gauld alan.ga...@btinternet.com wrote:
Tino Dai obe...@gmail.com wrote
I'm beefing up my Object
I haven't read it yet myself, but the below book just came out:
http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=cm_cr_pr_sims_t
I'm not aware of any other book that focuses exclusively on OO in Python,
though you'll find good intros to the topic in a number of the
Am 30.08.2010 20:13, schrieb Tino Dai:
Hi Everybody,
I'm beefing up my Object-Oriented Analysis and Design - getting
the gaps in my
knowledge filled in through the Head First OOAD book
(http://headfirstlabs.com/books/hfooad/).
That book focuses on Java - is there a comparable book for
You could google for
1) Alex Martelli, Design Patterns
He's a Pyton guru and there're some online talks (at Google and some
conferences) about DP; a bit difficult to understand, well, he's guru ;-)
2) http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html
I like that one.
Also,
Tino Dai obe...@gmail.com wrote
I'm beefing up my Object-Oriented Analysis and Design -
getting
the gaps in my
knowledge filled in through the Head First OOAD book
I don't know it although I've seen a couple of others in the series.
My recommendations for general OOAD books are:
kevin hayes kevino...@gmail.com wrote
Hi all! I'm trying to write a basic text adventure game to start
learning
python (just for fun). I've gone through the first four chapters of
a learn
python game programming book and I'm having trouble with the
exercise on
writing a text adventure.
Thanks to Luke for pointing out that Room1() did not return anything.
I now add a return statement:
9) have the functions return text rather than printing it. Use triple
quoted text. e.g.:
def Room1():
description = You find yourself in a large room. Above you is a
massive crystal
Now, I'm no pro at programming in Python, but here's what I recommend you
do. I would have a class at the beginning to define all of the rooms, and
then have the rest of the code below that. Then, it makes it easier to
follow. In addition, I would also have a function that stores the name of
the
On 8/27/2010 9:42 PM, kevin hayes wrote:
Hi all! I'm trying to write a basic text adventure game to start
learning python (just for fun). I've gone through the first four
chapters of a learn python game programming book and I'm having
trouble with the exercise on writing a text adventure.
Hi. Good day.
I am having an import error problem. Last week, I was following this site:
http://sites.google.com/site/spatialpython/processing-aster-with-python-numpy-and-gdal.
I was able to make the python script run on the terminal. But this week, it
was throwing some error.
This
Evert,
I got it back working. But it was with some stroke of luck. And I dont know
the explanation.
I installed the latest source of GEOS (as suggested by someone from the gdal
channel). Then i tried the script. It gave me a different import error.
ImportError: libgeos-3.3.0.so: cannot open
I got it back working. But it was with some stroke of luck. And I dont know
the explanation.
I installed the latest source of GEOS (as suggested by someone from the gdal
channel). Then i tried the script. It gave me a different import error.
ImportError: libgeos-3.3.0.so: cannot open
Evert,
Thank you very much. I do hope it goes on working. :D
Roy
On Mon, Aug 2, 2010 at 2:09 AM, Evert Rol evert@gmail.com wrote:
I got it back working. But it was with some stroke of luck. And I dont
know the explanation.
I installed the latest source of GEOS (as suggested by
John Palmer speederpyt...@gmail.com wrote
I have the program working nearly as I want it to be. The only
problem is,
that when the user is prompted to enter its chosen word, (I am using
a raw
input) and the word is typed in, it shows in the line above,
Take a look at the getpass module.
John Palmer speederpyt...@gmail.com wrote
Modifying the subject...
And I repeat, please don't send the whole digest,
delete the excess irrelevant stuff! (see below!)
Thanks a lot for the help guys, but when I use the
getpass.getpass(Enter
your word here, I get a different response to what you
On Tue, Jul 13, 2010 at 12:34 PM, Nitin Pawar nitinpawar...@gmail.com wrote:
Adding to what Andre said,
another way of optimizing the problem would be
storing the prime number in the range you want to check an array and see if
the given number is divisible by any of those prime number
As I
On Thu, 15 Jul 2010 01:11:58 am Vineeth Rakesh wrote:
Hello all,
I want to calculate the execution time of a program. Say I have a
function like below:
def RepAdd(i):
j = 0
while(ji):
j += 1
return j
now I want to calculate the execution time of the function RepAdd
when say
Hi,
You have two different problems
1) Easiest algorithm to find a prime number
2) and then coding the algorithm
By my knowledge,The Sieve of Eratosthenes algorithm is the fastest to find a
prime number.
The algorithm works on the basis that if a number n is prime, then all
multiples of it are
On Tue, Jul 13, 2010 at 11:50 AM, Dipo Elegbede delegb...@dudupay.com wrote:
I was trying to write a code that prints prime numbers between 1 and 20.
I have by myself seen that something is wrong with my code and also my
brain.
Could anyone be kind enough to tell me what to do
Where I
Adding to what Andre said,
another way of optimizing the problem would be
storing the prime number in the range you want to check an array and see if
the given number is divisible by any of those prime number
This improves the performance.
Thanks,
nitin
On Tue, Jul 13, 2010 at 3:52 PM, Andre
Dipo Elegbede wrote:
I was trying to write a code that prints prime numbers between 1 and 20.
I have by myself seen that something is wrong with my code and also my
brain.
Could anyone be kind enough to tell me what to do
Where I am confused is how to test for other numbers without one
You have gotten good advice from others.
My request is that you provide a meaningful subject when you post a
question. We track by subject. Help is not the best subject.
Better would be How to find prime numbers
--
Bob Gailer
919-636-4239
Chapel Hill NC
On 7/13/2010 5:50 AM, Dipo Elegbede wrote:
I was trying to write a code that prints prime numbers between 1 and 20.
Other suggestions
- you need only test divisors up to the square root of the candidate.
- you can easily eliminate all even numbers and numbers divisible by 3.
for i in
On Tue, Jul 13, 2010 at 3:20 PM, Dipo Elegbede delegb...@dudupay.comwrote:
I was trying to write a code that prints prime numbers between 1 and 20.
I have by myself seen that something is wrong with my code and also my
brain.
Could anyone be kind enough to tell me what to do
Where I
On 5 July 2010 19:54, Vineeth Rakesh vineethrak...@gmail.com wrote:
Can some one help me to return a special pattern from a list.
say list =
[something1.mp3,something2.mp3,something4.pdf,something5.odt]
now say I just need to return the files with .mp3 extension. How to go about
doing this?
On Mon, Jul 5, 2010 at 11:24 PM, Vineeth Rakesh vineethrak...@gmail.comwrote:
Hello all,
Can some one help me to return a special pattern from a list.
say list =
[something1.mp3,something2.mp3,something4.pdf,something5.odt]
One suggestion. Don't name a list as list. Use l or List or any
On Mon, Jul 5, 2010 at 11:58 PM, Shashwat Anand anand.shash...@gmail.comwrote:
On Mon, Jul 5, 2010 at 11:24 PM, Vineeth Rakesh
vineethrak...@gmail.comwrote:
Hello all,
Can some one help me to return a special pattern from a list.
say list =
Shashwat Anand anand.shash...@gmail.com wrote
list =
[something1.mp3,something2.mp3,something4.pdf,something5.odt]
[i for i in list if i[-4:] == '.mp3']
['something1.mp3', 'something2.mp3']
Or even easier:
[s for s in list if s.endswith('.mp3')]
But for the specific case of file
On Mon, 05 Jul 2010 20:29:02 +0200
tutor-requ...@python.org wrote:
Date: Mon, 5 Jul 2010 13:54:55 -0400
From: Vineeth Rakesh vineethrak...@gmail.com
To: tutor@python.org
Subject: [Tutor] Help return a pattern from list
Message-ID:
On 7/5/2010 4:19 PM Alan Gauld said...
But for the specific case of file extensions the os.path.splitext() is
a better solution.
If, as the names suggest, the source is the file system, then I'd reach
for glob.
Emile
___
Tutor maillist -
On 07/03/2010 08:25 AM, Jim Byrnes wrote:
Jeff Johnson wrote:
On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question
because I want, for my own satisfaction, to rewrite one of my Access dbs
(one that does our finances) into a stand-alone Python database program
using SQLite. I know
On Sun, Jul 4, 2010 at 3:20 PM, John Palmer speederpyt...@gmail.com wrote:
Hi
I've just decided to try an learn python but i'm already stuck on one of the
first exercises, i've given the link below:
http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_programs
The exercise that
John Palmer speederpyt...@gmail.com wrote
I've looked at the solution but it appears not to be working when i
use this
code
File hello.py, line 1
print (Hello, , end= )
^
SyntaxError: invalid syntax
This is Python V3 syntax, I suspect you have Python v2
801 - 900 of 1500 matches
Mail list logo