I have a file called increment.py as follows:
#!/usr/bin/python
n = 0
while True:
n = int(raw_input(n)) + 1
This is easy to understand, but I want to pipe it's input/output
by another python program. (I will show what I
I have a program called increment.py as follows:
#!/usr/bin/python
n = 0
while True:
n = int(raw_input(n)) + 1
This is probably very easy to understand, but I want to run this program
from another python program.
Below is an attempt
Op donderdag 17-06-2010 om 12:51 uur [tijdzone -0700], schreef Back9:
> Hi,
>
> I have one byte data and want to know each bit info,
> I mean how I can know each bit is set or not?
>
> TIA
def bitset(x, n):
"""Return whether nth bit of x was set"""
return bool(x & (1 << n))
--
http://mail.pyt
Op donderdag 17-06-2010 om 13:01 uur [tijdzone -0700], schreef Stephen
Hansen:
> On 6/17/10 12:13 PM, Laurent Verweijen wrote:
> > How do I make sure the inputstream stays open after the first call to
> > communicate?
>
> This was just asked a few days ago in different
Op donderdag 17-06-2010 om 13:48 uur [tijdzone -0700], schreef Stephen
Hansen:
> On 6/17/10 1:42 PM, Laurent Verweijen wrote:
> > I tried putting what Ian Kelly said in my code, by it doesn't work for
> > me.
> >
> > Python 2.6.5 (r265:79063, Apr 16 2010, 13:5
Op donderdag 17-06-2010 om 23:09 uur [tijdzone +0200], schreef Laurent
Verweijen:
> Op donderdag 17-06-2010 om 13:48 uur [tijdzone -0700], schreef Stephen
> Hansen:
> > On 6/17/10 1:42 PM, Laurent Verweijen wrote:
> > > I tried putting what Ian Kelly said in my code, b
Op donderdag 17-06-2010 om 14:36 uur [tijdzone -0700], schreef Stephen
Hansen:
> On 6/17/10 2:09 PM, Laurent Verweijen wrote:
> > It just gives me an empty string.
> >
> > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> > [GCC 4.4.3] on linux2
> > Type
Op donderdag 17-06-2010 om 14:48 uur [tijdzone -0700], schreef Stephen
Hansen:
> On 6/17/10 2:40 PM, Laurent Verweijen wrote:
> > Op donderdag 17-06-2010 om 14:36 uur [tijdzone -0700], schreef Stephen
> > Hansen:
> >> On 6/17/10 2:09 PM, Laurent Verweijen wrote:
> &g
Op donderdag 17-06-2010 om 15:16 uur [tijdzone -0700], schreef Stephen
Hansen:
> On 6/17/10 3:06 PM, Laurent Verweijen wrote:
> >>
> >> In your other thread you include an actual traceback:
> >>
> >> Traceback (most recent call last):
> &
Since I was relatively new to python when python 3 was released (I'm
using it since python 2.5) I don't really care about the print
statement. Making print a function makes print less an exception since
all other functions need brackets.
I also like most of the other changes in python 3 like float
In contrast to java or c python seems not be able to use a random
delimiter.
In java, you can do:
Code:
import java.util.Scanner
Scanner sc = new Scanner(System.in).useSeperator(" ")
int a = sc.nextInt()
But in python there seems to be no other option then waiting until you
see a newline.
I
11 matches
Mail list logo