On Fri, Mar 16, 2012 at 2:52 PM, Boris Vladimir Comi
gle...@comunidad.unam.mx wrote:
Hello, I am writing to request your help in the realization of a script. I
am new to this and I'm just learning the wonderful world of python and this
has made me a little difficult.
Briefly I commented what
On Fri, Mar 16, 2012 at 2:58 PM, Joel Goldstick
joel.goldst...@gmail.com wrote:
On Fri, Mar 16, 2012 at 2:52 PM, Boris Vladimir Comi
gle...@comunidad.unam.mx wrote:
Hello, I am writing to request your help in the realization of a script. I
am new to this and I'm just learning the wonderful
On 16/03/12 18:52, Boris Vladimir Comi wrote:
*File /home/mcidasv/JYTHON/TIR.py, line 22
count = count + 1;
^
SyntaxError: invalid syntax*
Error messages indicate where Python found the problem.
Often the real problem is a line or so before that.
In your case you omitted the colon after the
First off I want to really thank you for all of the help! I am in my
first semester as I started as a non traditional student in January.
Even though I am in an intro class I think that many of my class mates
had more of a c/s foundation in high then I did. It took me a few
tries but I did finally
import random #import random number generator module
target = random.randint(1,100) #generates random number between 1 and 100
guess = float(raw_input('pick a number between 1 and 100'))
while guess != target:
if guess target: print 'too low'
elif guess target: print 'too high'
On Thu, 23 Feb 2012, Saad Javed wrote:
I am learning python and need guidance for
writing some code. I've written a simple
program (with pointers from people) that
parses an tv show xml feed and prints their
values in plain text after performing some
string operations.
Unless you're really
On 2/24/2012 10:18 PM, Carolina Dianne LaCourse wrote:
Hi,
I have never programed before and am brand new to python also. I am
trying to create a Hi-Lo game and am not really sure where to start.
These are the instructions that I have. I know that I will need to
import the random number
Carolina Dianne LaCourse wrote:
[...]
I understand that I need to ask for raw input from the user and that I
need to be able to use the if elif else to tell the user whether their
number matches or id too high or to low but am just not sure what to
do first. Any advice would be greatly
On 23/02/12 00:59, Saad Javed wrote:
[CODE]feed = urllib.urlopen(rssPage) #rssPage: address of xml feed
tree = etree.parse(feed)
x = tree.xpath(/rss/channel/item/title/text())
x = str(x[0])
for tag in tags: #tags is a list of items like hdtv, xvid, 720p etc
x = re.sub(r'\b' + tag + r'\b', '',
Sorry for the formatting. Added return statements to both functions. Adding
return [x, y] to get_value func. That solved the problem. Thank you! :)
Saad
On Thursday, February 23, 2012, Alan Gauld wrote:
On 23/02/12 00:59, Saad Javed wrote:
[CODE]feed = urllib.urlopen(rssPage) #rssPage:
On 2/22/2012 1:50 PM, leo degon wrote:
Hello All,
My name is Leo.
Hi Leo Welcome to Python help.
We are a few volunteers who like assisting others.
A few guidelines:
- always reply-all so a copy goes to the list
- reply in-line rather than at the top.
- if your code is large put
On 22/02/12 18:50, leo degon wrote:
Hello All,
My name is Leo. I'm just beginning to learn python. I am
learning on my own and have no previous programming experience. I
decided to create a version of john conway's game of life as a personal
project.
OK, Thats quite a good project
On 2012-02-23 01:59, Saad Javed wrote:
I am learning python and need guidance for writing some code. I've written
a simple program (with pointers from people) that parses an tv show xml
feed and prints their values in plain text after performing some string
operations.
[CODE]feed =
Which ones did you look at, and why did you not like them? Keep in mind that
Glade is an interface builder, and hasn't got anything much to do with the
target language, other than requiring there be a libglade library to read the
XML files.
I actually got started with some articles in Linux
On Thu, Jan 19, 2012 at 6:32 PM, Jason Loeve jasonlo...@gmail.com wrote:
good day i seem to be stuck, my code is
from sys import argv
script, user_name = argv
Are you passing an additional parameter while executing the script ?? you
must execute it passing an additional parameter which
If I say that sys.argv is a list, does that help you?
Also, run things from a command prompt for this kind of thing, at least then
you can guarantee what args get passed
Bodsda
Sent from my BlackBerry® wireless device
-Original Message-
From: Jason Loeve jasonlo...@gmail.com
Sender:
Hi Jason,
On 19 January 2012 13:02, Jason Loeve jasonlo...@gmail.com wrote:
good day i seem to be stuck, my code is
from sys import argv
script, user_name = argv
and i get an error ValueError: need more than 1 value to unpack
The implication of this message is that the value of argv
On Wed, Jan 4, 2012 at 9:45 PM, Nate Lastname defens...@gmail.com wrote:
Hello!
The attached file 'cameramovement.py' is very laggy. Could someone help me
out by telling me what part of this is slowing it down so much? I've
checked the whole file through, and I can't see why it's so slow.
On 28/12/11 01:31, nickto...@comcast.net wrote:
hello, my name is nick. i got python for software design by Allen B.
Downey as a gift for christmas. i am completely new to programming
Welcome, we are here to help :-)
5
x=5
x+1
im ok when it comes to using python so far. but it has asked me
On Tue, Dec 27, 2011 at 8:31 PM, nickto...@comcast.net wrote:
hello, my name is nick. i got python for software design by Allen B.
Downey as a gift for christmas. i am completely new to programming and i am
having trouble figuring out how to do an exercise concerning script..
my problem
5
Emeka wrote:
Could someone explain functools.update_wrapper with simple examples?
Since this is not for the absolute beginner I'm assuming you are already
familiar with decorators. In their most common form these are functions that
take a function and wrap that function into another
Just a guess but take a look at the spelling.
centerx
Or
centrex
Bodsda
Sent from my BlackBerry® wireless device
-Original Message-
From: Chloe Beck chloeb...@hotmail.com
Sender: tutor-bounces+bodsda=googlemail@python.org
Date: Sun, 20 Nov 2011 11:58:25
To: tutor@python.org
Chloe Beck wrote:
Traceback (most recent call last):
File /Users/Chloe/Documents/SKI SKI/ski ski ski, line 99, in module
skier.move(speed)
File /Users/Chloe/Documents/SKI SKI/ski ski ski, line 28, in move
if self.rect.centerx 20: self.rect.centrex = 20
AttributeError:
On 2011-11-04 20:59, Albert-Jan Roskam wrote:
It seems that you are not opening the file properly. You could do
f = file('///Users/joebatt/Desktop/python3.txt','r')
or:
withfile('///Users/joebatt/Desktop/python3.txt','r') as f:
OP is using Python 3, where file is removed. Thus, you have to use
On Fri, Nov 4, 2011 at 3:42 PM, Joe Batt joeb...@hotmail.co.uk wrote:
Hi all,
Still trying with Python and programming in general….
I am trying to get a grip with re. I am writing a program to open a text
file and scan it for exactly 3 uppercase letters in a row followed by a
lowercase
It seems that you are not opening the file properly. You could do
f = file('///Users/joebatt/Desktop/python3.txt','r')
or:
withfile('///Users/joebatt/Desktop/python3.txt','r') as f:
for line in f:
m = re.search([A-Z]{3}[a-z][A-Z]{3}, line)
if m:
print(Pattern found)
m = re.search([A-Z]{3}[a-z][A-Z]{3}, line)
That is the expression I would suggest, except it is still more efficient to
use a compiled regular expression like the original version.
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX
Prasad, Ramit wrote:
m = re.search([A-Z]{3}[a-z][A-Z]{3}, line)
That is the expression I would suggest, except it is still more
efficient to use a compiled regular expression like the original
version.
Not necessarily. The Python regex module caches recently used regex
strings, avoiding
(Pleas put your reply after the part you're quoting. What you did is
called top-posting, and makes reading the messages very confusing)
On 11/01/2011 12:10 AM, Chris Kavanagh wrote:
I'm going to thank Steven once again, and answer my own question in
the 2nd paragraph directly below (Steven
On 01/11/11 04:10, Chris Kavanagh wrote:
before. In other languages, ala C++, don't global variables have to be
declared at the 'top' of the code??
No, that's just common usage.
You can declare a variable anywhere in C/C++ provided it's before
it is used. But that can lead to hard to read
Chris Kavanagh wrote:
However, I'm confused on Line 30 {if chosenCave== str(friendlyCave)}.
Here's the description of this line the author gives:
Here we check if the integer of the cave we chose ('1' or '2') is equal
to the cave
randomly selected to have the friendly dragon
My question
Yes Steven, that solved my question(s). It also cleared up what was to
be my next question! Thanks so much. You might not realize how grateful
I am to be able to have you others on the list answer my questions.
Just trust me when I say, I am grateful. And I apologize for the code
being
I'm going to thank Steven once again, and answer my own question in the
2nd paragraph directly below (Steven hasn't had a chance to respond yet).
I just learned that the Function definitions are not read by the
interpreter UNTIL they are called. I was reading them and assuming they
were
On 10/10/11 20:23, George Nyoro wrote:
On 10/10/2011, tutor-requ...@python.orgtutor-requ...@python.org wrote:
Send Tutor mailing list submissions to
tutor@python.org
To subscribe or unsubscribe via the World Wide Web, visit
snip
When replying, please edit your Subject
On 09/10/11 23:41, D. Guandalino wrote:
Hi, in this class many methods share common code.
class Foo(object):
def m1(self):
if self.foo:
pass # m1 do something
elif self.bar:
pass # m1 do something else
else:
pass # m1 do
D. Guandalino wrote:
Hi, in this class many methods share common code.
Given your example, I wouldn't bother refactoring it. There's not enough
code in common to matter.
--
Steven
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
On 10/7/11, rmntcver...@aol.com rmntcver...@aol.com wrote:
I need serious help with this Rock, Paper, Scissors program. The program
runs smoothly but I can't get the score to print. Please help me with this
one aspect! Here is my code right now:
import random
def
On 10/7/2011 12:32 PM, rmntcver...@aol.com wrote:
I need serious help with this Rock, Paper, Scissors program. The
program runs smoothly but I can't get the score to print. Please help
me with this one aspect! Here is my code right now:
Welcome to Python Help.
In future please use a
On 06/10/11 08:15, Praveen Singh wrote:
CountWords(google)
[('e',1),('g',2),('l',1),('o',2)]
by the level of this question you can easily understand i am new in
python.the problem i am facing is how to make set of word and count(e,1)
and add this to list??
Some clues:
a for loop will
On Tue, 27 Sep 2011 14:32:00 -0400
c smith illusiontechniq...@gmail.com wrote:
hi list,
i understand the general idea of recursion and if I am following well
written code I can understand how it works, but when I try to write
it for myself I get a bit confused with the flow.
I was trying to
c smith wrote:
hi list,
i understand the general idea of recursion and if I am following well
written code I can understand how it works, but when I try to write it for
myself I get a bit confused with the flow.
Your flow is fine. You just forget to return anything in two of the
three
Mac Ryan wrote:
raise BaseException('Something is wrong here!')
Never raise BaseException directly! BaseException is the very top of the
exception hierarchy, you should raise the *most* specific exception you
can, not the least specific. BaseException isn't even just for errors,
it's
On 27/09/11 19:32, c smith wrote:
i understand the general idea of recursion and if I am following well
written code I can understand how it works, but when I try to write it
for myself I get a bit confused with the flow.
Others have dealt with the specifics.
If you really want to learn how
From: tutor-bounces+ramit.prasad=jpmorgan@python.org
[mailto:tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of Joseph
Shakespeare
Sent: Thursday, September 22, 2011 12:05 PM
To: tutor@python.org
Subject: [Tutor] Help!
Hello,
I am new Python (about 2 weeks) and need some
Move the following two lines to immediately follow the while.
player=raw_input(Please pick your throw: (r,s,p):)
computer= random.choice(['r','s','p'])
--
I have seen the future and I am not in it.
___
Tutor maillist - Tutor@python.org
To
Robert Sjoblom wrote:
#assuming target number 15
roll = (result, initial_mins, initial_max)
if roll[0] 15:
if roll[1] = 2:
print(Success)
elif roll[2] = 2:
print(Critical failure!)
else:
print(Failure.)
elif roll[0] = 15:
if roll[1] = 2:
: Friday, August 26, 2011 8:55 AM
To: Christopher King
Cc: python mail list
Subject: Re: [Tutor] Help with if-elif-else structure
Hello,
I'm quite new on python, so don't hit too hard if I'm wrong ;)
A question on the logic... Does this means
if roll[0] 15:
if roll[1] = 2
Subject: Re: [Tutor] Help with if-elif-else structure
Hello,
I'm quite new on python, so don't hit too hard if I'm wrong ;)
A question on the logic... Does this means
if roll[0] 15:
if roll[1]= 2:
print(Success)
elif roll[2]= 2:
print(Critical failure!)
that rolling
Hello,
I'm quite new on python, so don't hit too hard if I'm wrong ;)
A question on the logic... Does this means
if roll[0] 15:
if roll[1] = 2:
print(Success)
elif roll[2] = 2:
print(Critical failure!)
that rolling multiple 1's get the priority on rolling multiple 6's? I
Of TheIrda
Sent: Friday, August 26, 2011 8:55 AM
To: Christopher King
Cc: python mail list
Subject: Re: [Tutor] Help with if-elif-else structure
Hello,
I'm quite new on python, so don't hit too hard if I'm wrong ;)
A question on the logic... Does this means
if roll[0] 15:
if roll[1] = 2
Well, I'm not sure what your asking for the first question, but for the
second one, you would have an unhandled exception in your code if roll[0]
was less than or equal to 0. Hope that helps a bit!
On Fri, Aug 26, 2011 at 8:55 AM, TheIrda thei...@gmail.com wrote:
Hello,
I'm quite new on
Thanks for the feedback. I wasn't aware about the assert usage not
being intended for production code.
On Wed, Aug 24, 2011 at 11:37 PM, Alan Gauld alan.ga...@btinternet.com wrote:
On 24/08/11 21:03, Prasad, Ramit wrote:
I was under the impression that asserts are more for testing
than for
On 25/08/11 08:51, Robert Sjoblom wrote:
If I roll two sixes (on the initial roll) and below the target number
(in total), it's a failure.
If I roll two sixes (on the initial roll) and above the target number
(in total), it's a critical failure.
If I roll two ones (on the initial roll) and
#assuming target number 15
roll = (result, initial_mins, initial_max)
I'd forget the tuple and just use the names,
it is more readable that way...
if result 15:
if initial_mins = 2:...
elif initial_max =2:...
But otherwise it seems to reflect the rules as you've written them...
John wrote:
Thanks for the feedback. I wasn't aware about the assert usage not
being intended for production code.
That's not quite true. There is nothing wrong with using asserts in
production code. The important thing is to use them *properly*. Asserts
are for checking your internal
Looks good, although I would add one or two things.
#assuming target number 15
Put that in a variable for the target number
roll = (result, initial_mins, initial_max)
if roll[0] 15:
if roll[1] = 2:
You could even put all the constants in variables
print(Success)
elif
Ha! Inheritance!
On Thu, Aug 25, 2011 at 7:51 PM, John washa...@gmail.com wrote:
Hello, I am writing a module that will have two classes ('runners') I
am calling them, as they will ultimately use subprocess to run a
command line program, so they are basically option parsers, etc...
As I
On Thu, Aug 25, 2011 at 1:51 PM, John washa...@gmail.com wrote:
Hello, I am writing a module that will have two classes ('runners') I
am calling them, as they will ultimately use subprocess to run a
command line program, so they are basically option parsers, etc...
As I wrote the second
John wrote:
I know a code example might help, so I try to show it here (my code
I'm afraid is too complex and ugly at the moment). You can see the it
fails because MyTools doesn't have 'this' attribute...
Then give it one.
class MyTools:
Add an initialisation method:
def
On Wed, Aug 24, 2011 at 8:34 PM, John washa...@gmail.com wrote:
Hello, I have a class that has an attribute that is a dict which I
fill with more dicts. I've created a function to return those
dictionaries if a key is provide, otherwise, it returns the 'default'
dictionary.
I have the
Thank you. I've corrected the KeyError, and changed the function to:
def overide_options(self, options, run_id=None):
completely overide the options dict
assert isinstance(options, dict), override options requires a dict
if run_id in self.run_queue:
I was under the impression that asserts are more for testing than for
production code (especially since they can be removed when running from python
from command line). Instead I removed the assert and replaced it to raise an
error.
def overide_options(self, options, run_id=None):
On 24/08/11 21:03, Prasad, Ramit wrote:
I was under the impression that asserts are more for testing
than for production code
That's true.
def overide_options(self, options, run_id=None):
if not isinstance(options, dict):
raise TypeError(override options requires
On 16/08/11 05:31, aditya wrote:
Hello tutors,
I wanted some help in using the Tkinter class for button creation, I am
not able to add on click events i.e. when I press the button certain
action should be performed for example if I press the button named 5,
then it should display 5 in the text
=gmail@python.org
Date: Mon, 4 Jul 2011 23:59:48
To: tutor@python.org
Subject: Re: [Tutor] Help with making emacs work with python syntax
checking?
Tidal Espeon tidal.esp...@gmail.com wrote
I need help with installing this setup on my emacs:
Why do you want this? Are you already an emacs
On Monday 04 July 2011 15:46:31 Tidal Espeon wrote:
I need help with installing this setup on my emacs:
http://hide1713.wordpress.com/2009/01/30/setup-perfect-python-environment-i
n-emacs/ The problem is that I have no clue how to access any .emacs file or
.emacs.d folder. I'm running linux,
Tidal Espeon wrote:
I need help with installing this setup on my emacs:
http://hide1713.wordpress.com/2009/01/30/setup-perfect-python-environment-
in-emacs/
The problem is that I have no clue how to access any .emacs file or
.emacs.d folder. I'm running linux, and they are apparently
Tidal Espeon tidal.esp...@gmail.com wrote
I need help with installing this setup on my emacs:
Why do you want this? Are you already an emacs
user? If so then fine, go ahead. But if you do not
already use emacs, lerarning it will be a big effort.
emacs is a big, powerful tool and once you
To: tutor@python.org
Subject: Re: [Tutor] Help with making emacs work with python syntax checking?
Tidal Espeon tidal.esp...@gmail.com wrote
I need help with installing this setup on my emacs:
Why do you want this? Are you already an emacs
user? If so then fine, go ahead. But if you do not
already
Robert...I am similarly where you are stuck, a beginner with little insight, so
my perspective might have some draw to it. Try this on for size - while
watching a friend stencil Christmas decorations on living room windows last
year, it dawned on me that a class is quite simply - a stencil.
That's pretty much all you need to know to start using objects. There's
a lot more though: inheritance, class methods and static methods (as
opposed to ordinary methods), properties, descriptors (advanced!),
slots, and more. But one step at a time.
Any questions, don't hesitate to ask!
Wow,
On Sat, 21 May 2011 08:24:34 pm Robert Sjöblom wrote:
I'm trying to wrap my head around classes and their attributes, but
am having a hard time doing so. The websites and books that I have
consulted haven't been much help; most of them assume prior
programming/oop experience, something I lack.
On 5/21/11, Robert Sjöblom robert.sjob...@gmail.com wrote:
I'm trying to wrap my head around classes and their attributes, but am
having a hard time doing so. The websites and books that I have consulted
haven't been much help; most of them assume prior programming/oop
experience, something I
Robert Sjöblom robert.sjob...@gmail.com wrote
I'm trying to wrap my head around classes ...The websites
and books that I have consulted ...assume prior
programming/oop experience, something I lack.
Alex, and especially Steven (great job BTW!,) have given you good
explanations, provided you
What a phenomenally clear explanation.
Thank you very much, Steven.
Robert Berman
On 05/21/2011 07:49 AM, Steven D'Aprano wrote:
On Sat, 21 May 2011 08:24:34 pm Robert Sjöblom wrote:
I'm trying to wrap my head around classes and their attributes, but
am having a hard time doing so. The
On 14-05-11 05:05, Wayne Werner wrote:
On Fri, May 13, 2011 at 7:48 PM, Lea Parker lea-par...@bigpond.com
mailto:lea-par...@bigpond.com wrote:
Hello
I have another assignment I am trying to fine tune. The idea is to
make sure exceptions work. I have come up with a problem when
On Fri, May 13, 2011 at 7:48 PM, Lea Parker lea-par...@bigpond.com wrote:
Hello
I have another assignment I am trying to fine tune. The idea is to make
sure exceptions work. I have come up with a problem when testing my code.
When I enter a golf score for a player the program returns the
On 01/-10/-28163 02:59 PM, monkey...@aim.com wrote:
Hello,
I am trying to learn how to use python with Facebook's Open Graph API. I am
getting my feet wet with the following code authored by Matthew A. Russell. I
copied it line for line for learning purposes, but I am getting the following
Ratna Banjara wrote:
The number 124 has the property that it is the smallest number whose
first three multiples contain the digit 2. Observe that
124*1 = 124, 124*2 = 248, 124*3 = 372 and that 124, 248 and 372 each
contain the digit 2. It is possible to generalize this property to be
the
On Sat, Apr 16, 2011 at 4:33 AM, Lea Parker lea-par...@bigpond.com wrote:
budget = float(raw_input('Enter the amount of your budget for the month:
'))
# Validation variable for budget
while budget 0:
print 'ERROR: the budget cannot be a negative amount'
budget
I think that here:
expense = float(raw_input('Enter the next expense or 0 to finish $'))
you want to use `expense +=` instead. Instead of adding it to the
previous expenses, you're resetting the `expense` variable each time.
I think there's some other things that won't behave as
On Fri, Apr 15, 2011 at 5:52 PM, Lea Parker lea-par...@bigpond.com wrote:
Hello
I am trying to create this program for a uni assignment. I cannot get it to
add the expenses to the accumulator I have set. Would you mind having a look
and letting me know if I have something in the wrong
Hi Lea, how are you today?
Well please keep in mind that nothing is wrong with your code, its doing
exactly what you asked it to do. But I would call your attention to your while
loop, you want to accumulate things, but may I ask exactly what are you
accumulating in your loop?
Also quite by
Lea Parker lea-par...@bigpond.com wrote
I am trying to create this program for a uni assignment. I cannot
get it to
add the expenses to the accumulator I have set.
You have to write the code to add each value to the accumulator
Your loop does not do that
This program is to calculate
2011/4/2 ISAAC Ramírez Solano danielramso...@hotmail.com
Hi... My name is Isaac, I need some help to programm in python, I know some
things that are really basic like lists and recursivity and with that we
shoul create an GPS with a global variable, but what I'm trying to do is to
make a
ISAAC Ramírez Solano danielramso...@hotmail.com wrote
Hi... My name is Isaac, I need some help to program in python,
I know some things that are really basic like lists and recursivity
I'm not sure what you mean by recursivity, but I'm betting its
not what I mean by that term! :-)
with
On Mon, Mar 21, 2011 at 1:12 PM, Donald Bedsole drbeds...@gmail.com wrote:
This works fine as long as the user enters a number. However, if they
enter anything else, they just get the first :else statement, You
were too greedy.
I think that's because you're trying to do a string
Thank you, Marc
On Mon, Mar 21, 2011 at 4:47 PM, Marc Tompkins marc.tompk...@gmail.com wrote:
On Mon, Mar 21, 2011 at 1:12 PM, Donald Bedsole drbeds...@gmail.com wrote:
This works fine as long as the user enters a number. However, if they
enter anything else, they just get the first :else
Becky Mcquilling wrote:
If anyone is familiar with python-gnupg, I am having some difficulty with
the syntax. I've tried the following:
When dealing with third party packages, unless it is an extremely
well-known package like numpy or nltk, it is usually a good idea to link
to the project's
Thanks, everyone:
Your suggestions worked. I will make sure to include full information next
time.
Becky
On Sat, Mar 12, 2011 at 12:14 AM, Steven D'Aprano st...@pearwood.infowrote:
Becky Mcquilling wrote:
If anyone is familiar with python-gnupg, I am having some difficulty with
the
apple owner smer...@aol.com wrote
I am new to python and I am trying to open a plain
text file of names and to see the number of names
that start with specific letters and display them
in a bar graph.
OK, Lets break that down so that we can understand
what exactly puzzles you:
1) Can you
I would suggest to use the NLTK package.
Try methods like nltk.endswith() or nltk.startswith()
On Fri, Mar 11, 2011 at 5:36 AM, Alan Gauld alan.ga...@btinternet.comwrote:
apple owner smer...@aol.com wrote
I am new to python and I am trying to open a plain
text file of names and to see
Tiago Cunha tiago...@gmail.com wrote
I would suggest to use the NLTK package.
Try methods like nltk.endswith() or nltk.startswith()
NLTK is probably overkill.
The standard string methods startswith() and endswith()
are probably adequate for this case.
Alan G.
On Sat, Mar 12, 2011 at 1:39 AM, Becky Mcquilling
ladymcse2...@gmail.com wrote:
If anyone is familiar with python-gnupg, I am having some difficulty with
the syntax. I've tried the following:
f = open('c:/test/filename.txt', 'r')
datae = gpg.encrypt_file(f.read(), 'ladym...@gmail.com',
On Sat, Mar 12, 2011 at 2:07 AM, David Hutto smokefl...@gmail.com wrote:
As a matter of fact, looking at them with know
*no*
knowledge of the
module, it says it's a typeerror, and that it expects string or
buffer, but gets file. If this is the same error in both instances,
then it's that
On Tue, Mar 8, 2011 at 6:38 PM, Vickram vick1...@intnet.mu wrote:
The python result is wrong because I may have misread the C++ code
Well, really, I suggest you read a tutorial on Python - you don't seem
to be getting a hang on the basics, for example, there's no need for
to use the float()
The first hundred pages of a thorough python tutorial, and a c++
tutorial should have you doing both of those quite well in a day or
so.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Vickram vick1...@intnet.mu wrote
I need help in translating a C++ code into python..
Can you help please?
The python result is wrong because I may have misread the C++ code
The C++ code is really just C code, there is virtualy no C++ stuff
there.
But that aside your translation is pretty
On Mon, Mar 7, 2011 at 1:24 PM, vineeth vineethrak...@gmail.com 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
import re
file = open('file.txt','r')
file2 = open('newfile.txt','w')
LineFile = ' '
for line in file:
LineFile += line
StripRcvdCnt = re.compile('(P\w+\S\Content|Re\w+\S\Content)')
FindRcvdCnt = re.findall(StripRcvdCnt, LineFile)
for SrcStr in FindRcvdCnt:
file2.write(SrcStr)
701 - 800 of 1500 matches
Mail list logo