Hi,
> To clarify:
>
> print 1
> print 2
> print 3
>
> I want output to be
>
> 123
>>> l = [1, 2 3]
>>> i = int("".join(map(str, l)))
>>> print i, type(i)
123
If you don't care about the blanks, you can use
>>> print 1, 2, 3
1 2 3
Lutz
--
pub 1024D/6EBDA359 1999-09-20 Lutz Horn <[EMAIL
Now this is so basic, i am feeling sheepish asking
about it.
I am outputting to the terminal, how do i use a print
command without making it jump no newline after
execution, which is the default behaviour in python.
To clarify:
print 1
print 2
print 3
I want output to be
123
whereas by default
Thanks for the thoughts. I noticed that
you didn't post directly to the PythonCard users list, so you might not
be reading the discussion that followed. It sounds like MDI applications
are deprecated under Windows, so I'm going to go with a single tabbed window
with some small menuless child windo
> I ended up changing my approach so that it won't require appending to
> the list, but it's good to know anyway because I'm sure it will come up
> in the future. I'm sort of surprised there isn't a prepend() method for
> lists, but I'm sure there's a reason.
Hi Jay,
The interface of a data stru
Hi Sean!
Thanks for your measurements.
In the meantime I did another amendment,
leaving out the even numbers from the sieve.
It goes like this:
def sieve(maximum):
nums = range(3, maximum+1, 2)
for p in nums:
if p:
if p*p > maximum: break
start = (p*p-2)//2
> I am looking for a way to change keyboard output within
> Tkinter widget - for example, say I press "p" and I want
> it to come out as "t".
>
> Could anyone possibly point me in the right direction?
Take a look at the Event Driven programming topic in my tutor,
it covers reading keyboard inpu
Matt Williams wrote:
Dear List,
I'm trying to filter a file, to get rid of some characters I don't want
in it.
I've got the "Python Cookbook", which handily seems to do what I want,
but:
a) doesn't quite and
b) I don't understand it
I'm trying to use the string.maketrans() and string.translate().
On Sun, 20 Mar 2005 22:05:23 +, Matt Williams
<[EMAIL PROTECTED]> wrote:
> I've tried:
>
> #!/usr/bin/python
> import string
> test="1,2,3,bob,%,)"
> allchar=string.maketrans('','')
> #This aiming to delete the % and ):
> x=''.translate(test,allchar,"%,)")
>
> but get:
> TypeError: translate
I'm trying to filter a file, to get rid of some characters I don't want
in it.
The easiest thing to do is use the string method replace.
For example:
char = "1"
a = open("Myfile.txt","r")
b = a.read()
a.close()
b = b.replace(char,"")
a = open("Myfile.txt","w") ## Notice "w" so we can replace th
Hameed U. Khan wrote:
This else is the part of the for loop. And the statements in this else will be
executed if your for loop will complete all of its iterations. if you want
this else with 'if' statement then remove the for loop.
Or if you want the for loop to be part of the if then indent the
Dear List,
I'm trying to filter a file, to get rid of some characters I don't want
in it.
I've got the "Python Cookbook", which handily seems to do what I want,
but:
a) doesn't quite and
b) I don't understand it
I'm trying to use the string.maketrans() and string.translate(). From
what I've re
Gregor Lingl wrote:
The following variation of your sieve, using
extended slice assignment seems to
be sgnificantly faster. Try it out, if you like.
Here are the numbers:
Primes 1 - 1,000,000 timing:
extendedSliceSieve: 0.708388 seconds
listPrimes: 0.998758 seconds
karlSi
On Sun, 20 Mar 2005 19:38:40 -
"Igor Riabtchuk" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am totally new to Python and still learning.
>
> I am looking for a way to change keyboard output within Tkinter widget - for
> example, say I press "p" and I want it to come out as "t".
>
> Could anyone
Hi,
I am totally new to Python and still
learning.
I am looking for a way to change keyboard output
within Tkinter widget - for example, say I press "p" and I want it to come out
as "t".
Could anyone possibly point me in the right
direction?
Igor
On Sun, 20 Mar 2005 12:05:11 -0600, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Thanks for the thoughts. I noticed that you didn't post directly to the
> PythonCard users list,
Sorry, that was my bad, I cc'ed to the tutor list instead of the
Pythoncard list.
--
'There is only one basic hum
Karl Pflästerer schrieb:
On 19 Mrz 2005, [EMAIL PROTECTED] wrote:
[Code]
Maybe sombody likes...
I did it ... :
def sieve (max):
max = max + 1
border = round(max**0.5)
nums = range(0, max)
nums[0] = nums[1] = None
for p in nums:
if p:
if p >= border: break
On Fri, Mar 18, 2005 at 12:27:35PM -0500, Christopher Weimann wrote:
> So this [^\s]+ means match one or more of any char that
> isn't whitespace.
Could be just \S+
Greetings, J"o!
--
Reply hazy, ask again later.
___
Tutor maillist - Tutor@python
> I want a user to define an item and then
> define multiple characteristics about that item,
> save a dictionary of items,
> and then reload the items back into the GUI upon restart.
I'm still not absolutely sure what you mean. Do you mean
the GUI itself is going to grow new panels etc as
> > To clarify, what I'm trying to accomplish here is an overarching
application
> > window which contains other windows. At least, that's what it
would look
> > like under Windows.
You mean this would be an MDI Application?
There is usually a special class or attribute to support MDI in theGUI
to
Hameed U. Khan wrote:
This else is the part of the for loop. And the statements in this else will be
executed if your for loop will complete all of its iterations. if you want
this else with 'if' statement then remove the for loop.
for instance:
looking_for = 11
for i in range(0,10):
if i ==
On Sunday 20 Mar 2005 1846, Steve N wrote:
> This code runs, but it seems to me it should generate
> a syntax error. Can someone explain what's going on?
Why do you think there is a syntax error?
> x = [1,2,3,4]
> z = 4
> if z in x:
> print 'found:', z
if clause has been ended here.
> for i
This code runs, but it seems to me it should generate
a syntax error. Can someone explain what's going on?
x = [1,2,3,4]
z = 4
if z in x:
print 'found:', z
for i in x:
print 'in the loop with', i
else:
print 'not found:', z
>>>
found: 4
in the loop with 1
in the loop with 2
in the l
Brainerd HeadFat wrote:
Hi,
I'm having trouble trying to figure out how to create multiple
objects that contain duplicate entries that can be uniquely identified
within a Tkinter GUI.
I want a user to define an item and then
define multiple characteristics about that item,
save a dictionary o
23 matches
Mail list logo