I'm a bit confused about extracting data using re.search or re.findall.
Say I have the following code: tuples =
re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over',
text)
So I'm looking for that string in 'text', and I intend to extract the parts
which have parentheses around
Thanks Walter; I believe I understand the reasoning behind it, though not
all of the mechanics, but for now, your answer is more than sufficient.
-Alex
On Thu, Jun 14, 2012 at 4:10 PM, Walter Prins wrote:
> Hi Alex,
>
> On 14 June 2012 23:18, Alexander Quest wrote:
> &
seen this so far,
there is no variable called "_name_", and even if there was, why is it
comparing it to "_main_"? Why can't the main function just be called by
typing main()- why do we need this if statement to precede it? Thanks.
-Alex
On Thu, Jun 14, 2012 at 3:17 PM,
2 at 6:16 PM, Dave Angel wrote:
> On 06/07/2012 02:36 PM, Alexander Quest wrote:
> > Ok, thanks guys. I also had one more quick question regarding a piece of
> > boilerplate code:
> >
>
> To get a response, you will needs to leave your question at the python
> tut
Hey all; my question is regarding editing Python code in Notepad++. When I
run this piece of code in Notepad++:
def fix_start(s):
var1 = s[0]
var2 = "*"
var3 = s.replace(var1, var2)
return var3
I get an indentation error, which reads:
File "C:\google-python-exercises\google-python
My bad- meant to say [1]. Thanks.
-Alexander
On Fri, Aug 5, 2011 at 12:36 PM, Christopher King wrote:
>
>
> On Tue, Aug 2, 2011 at 10:44 PM, Alexander Quest wrote:
>>
>> have [0] to indicate that I want to go to the second value within that
>> first item,
re it is again for reference: attributes = [("strength", 0), ("health ",
0), ("wisdom ", 0), ("dexterity", 0)]
Sorry if this is a bit confusing. Thanks for your help and tips so far Bob.
-Alex
On Wed, Aug 3, 2011 at 5:52 AM, bob gailer wrote:
> On 8/2
en <__pete...@web.de> wrote:
> Alexander Quest wrote:
>
> > Hi guys- I'm having a problem with a list that has nested tuples:
> >
> > attributes = [("strength", 0), ("health ", 0), ("wisdom ", 0),
> > ("dexterity", 0)
Hi guys- I'm having a problem with a list that has nested tuples:
attributes = [("strength", 0), ("health ", 0), ("wisdom ", 0),
("dexterity", 0)]
I've defined the list above with 4 items, each starting with a value of 0.
The player
enters how many points he or she wants to add to a given item.
le's class works out with Python 3.1, and if not, I'll switch
over to a different one.
-Alexander
On Thu, Jul 28, 2011 at 10:27 PM, Steven D'Aprano wrote:
> Alexander Quest wrote:
>
>> To clarify, the particular file that was giving me trouble was the basic
>> &q
above truly is caused by version incompatibility).
-Alex
On Thu, Jul 28, 2011 at 7:58 PM, Alexander Quest wrote:
> Awesome- thanks for that Dave! The programs all work now, except that the
> google exercise programs are all from Python 2.X and I'm running 3.1, so
> some of them are g
again.
-Alex
On Thu, Jul 28, 2011 at 7:11 PM, Dave Angel wrote:
> On 07/28/2011 09:58 PM, Alexander Quest wrote:
>
>> I downloaded the google's python exercise files from their website (
>> http://code.google.com/edu/**languages/google-python-class/**set-up.html<http:
I downloaded the google's python exercise files from their website (
http://code.google.com/edu/languages/google-python-class/set-up.html),
unzipped them, and placed them in C.
I then added the following to the PATH variable under system settings so
that I could type "python" in command prompt and
-
>
> middle_number = lambda lo, hi: abs(lo - hi) // 2
>
> will work if you just need the mid point of two numbers; either ints or
> floats.
>
> mid_x = middle_number(0, 1000) # mid_x = 500
>
> DW
>
> On Jul 27, 2011, at 8:16 PM, A
Thanks Steven- I'll try that out.
-Alex
On Wed, Jul 27, 2011 at 5:40 PM, Steven D'Aprano wrote:
> Alexander Quest wrote:
>
>> Does anyone know how to assign a certain numerical range to a variable,
>> and
>> then choose the number that is the middle of that r
Does anyone know how to assign a certain numerical range to a variable, and
then choose the number that is the middle of that range? For example, I want
to assign the variable "X" a range between 1 and 50, and then I want to have
the middle of that range (25) return with some command when I call it
Hello- I am running Python v 3.1.1. As an exercise, I wrote a simple coin
flipper program, where the computer flips a coin 100 times and then prints
out the number of heads and tails. My program crashes immediately if I run
it normally through the command line, but if I go to "Run- Run Module," it
Hello; I'm a new student of Python using "Python Programming for Absolute
Beginners" 3rd edition by Michael Dawson as my guide. This is a basic
question regarding spaces. I'm not sure how to make it so spaces do not show
up between variables and basic strings, particularly before commas and after
d
18 matches
Mail list logo