Op 21-08-18 om 13:16 schreef Jacob Braig:
I am just starting out coding and decided on python. I am confused with
something I go shooting a lot so i wanted to make some stupid easy
calculator for ammo and slowly build the program up when I understand
python better but the code I have now keeps po
Instance created"
Foo() # print "Instance created"
Two instances are created, just that the second one isn't accessible.
Timo
main.mainloop()
===
any explanation gratefully recieved
Regards, Chris ROy-Smith
___
t's also possible to use multiple with statements on the same line. Can
someone with more expert Python knowledge than me comment on whether
it's different from using them separate as mentioned by Steven?
This is what I had in mind:
with open("writefi
Op 25-08-15 om 02:08 schreef Gonzalo V:
how can simulate or emulate an error 504?
I think using a site like http://httpbin.org/ is a bit easier than mock
or your own server.
Just change your request url to:
http://httpbin.org/status/504
Timo
i am new in python and its very intuitive
d.
- print is a function.
Updated code:
time = int(input("How long on average do you spend on the computer per day?"))
if time <= 2:
print("Message1")
else:
print("Message2")
Also the question is ambiguous. There is no time unit. What is "long&quo
tk API docs:
http://lazka.github.io/pgi-docs/index.html#Gtk-3.0
And here the tutorial:
http://learngtk.org/tutorials/python_gtk3_tutorial/html/
Timo
I realize that the program does not know what part of the object to get,
but I am unclear about how to tell it where the text is. I've tried
ons (with small
descriptions) on the sandbox page:
https://en.wikipedia.org/wiki/Special:ApiSandbox
Timo
*Joshua Valdez*
*Computational Linguist : Cognitive Scientist
*
(440)-231-0479
jd...@case.edu | j...@uw.edu | jo...@armsandanchors.com
<http://www.linkedin.c
yourself some time and use a raw string:
print(r""" """)
Timo
Spongebob Squarepants was, of course, the
obvious first choice. The heck with Tkinter. (Bob is coming out a bit thin
in my gmail but l
remove(...)
L.remove(value) -> None -- remove first occurrence of value.
Raises ValueError if the value is not present.
The same for help(list.sort) BTW.
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options
your example you convert the first
one to a list with list(), but not the second, so it prints the range
object.
>>> range(2)
range(0, 2)
>>> list(range(2))
[0, 1]
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or
g the rstrip function instead of calling
it and store the result. A big difference.
The fix is very easy, just call rstrip in your list comprehension:
k = [word.rstrip() for word in words]
A little tip: errors like these are easy to debug by printing your
values. If you printed k before continuing it wo
raceback (most recent call last):
File "", line 1, in
AttributeError: 'float' object has no attribute 'append'
Exactly the same as yours!
So, a float has no 'append' attribute, but what objects do have that?
Sounds like you need a list to hold an arbitr
ing list():
unvisited_caves = range(0,20)
I think you missed your own solution here, Alan. You probably meant:
unvisited_caves = list(range(0, 20))
Timo
...
unvisited_caves.remove(0)
However remove() may not do what you think. It removes the
value zero from your list not the first element. I th
Op 05-02-15 om 18:48 schreef Alan Gauld:
try:
>>> help( enumerate() )
Should be
>>> help(enumerate)
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Shift+tab does that in my editor. I don't know if this is a common
keybinding or editor specific.
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
cups, this is a project with Python bindings for
cups: https://pypi.python.org/pypi/pycups/1.9.66
Timo
Am 14.03.2014 11:40, schrieb Ulrich Goebel:
Hallo,
is there another way to pritt a PDF form python?
My problem is a PDF which is printed well by evince, but not with lp,
even not out of p
Here are the docs:
http://getbootstrap.com/
Everything is set up for you already so you can create good looking
websites in a flash.
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.or
ur results.
Something like;
cur = g.db.cursor()
cur.execute(.)
Not really.
sqlite3.connect() returns a sqlite3.Connection object which has a
execute method. It will create a cursor object for you.
Cheers,
Timo
HTH
___
Tutor maillist - Tutor@pyt
I have a datafile which is parsed by an external library, I'm having
trouble creating a hierarchical structure of the data.
This is what I got so far:
items = get_items() # returns a generator
for item in items:
print(item)
children = get_children(item) # also returns a generator
for
zling.
From the 2to3 --help:
-w, --write Write back modified files
So it's normal nothing happens to your files without the -w argument. It
just prints the changes to stdout.
Timo
Jim
___
Tutor maillist - Tutor@python.org
To un
16)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = "http://ff.f/";
>>> l[-1]
'/'
>>> l[-1] is not '/'
True
>>> l[-
socket(socket.AF_INET,socket.SOCK_DGRAM)
try:
s=s.bind(('172.18.2.11',2213))
print 'socket bind is complete'
except socket.error,msg:
print 'bind failed'
sys.exit()
You are hiding the error message here. Just print msg and see why it fails.
Timo
The outp
def __init__(self, name, hunger = 0, boredom = 0):
self.name = name
self.hunger = hunger
self.boredom = boredom
def __pass_time(self):
self.hunger += 1
self.boredom += 1
def __str__(self):
mood = self.boredom + self.hunger
return mood
to
use an outdated pip cause me problems?
I doubt it will. Have a look at the pip changelog to see what has been
changed.
Timo
But you're right, I also nnoticed that the Canonical repositories are
a little outdated sometimes. Would be nice if it's possible to add
pypi.org, so upda
Op 07-02-13 10:09, Sunil Tech schreef:
Thank you Wesley, Kal & tutor
In the future, the Python interpreter comes in handy for quick checks.
>>> def spam():
... pass
...
>>> s = spam()
>>> s, repr(s), type(s)
(None, 'None', )
Timo
On Thu, Feb 7,
get('custom-calc')
>>> custom_calc
'(%(a)s * %(b)s) / 10'
>>> calc_str = custom_calc % {'a': get_value_a(), 'b': get_value_b()}
I should parse this, fill in the values which the program has at that
point and calculate the outcome. What is
, you'll just need a way to
bencode the data.
Timo
[1] http://en.wikipedia.org/wiki/Torrent_file#Single_file
Any suggestions/pointers/ideas/links will be greatly appreciated
Thanks a ton,
cheers,
ashish
1. http://mktorrent.sourceforge.net/
2. http://www.robertnit
ith almost no memory overhead. It will
probably be better than your own custom dictionary-based approach or
even a db_row based solution.
"""
Timo
i tried this but to no avail:
>>> cur.execute('select * from schedule limit 10')
>>> for i in rang
to now be
42.098734087.
What about declaring the return value as x again?
x = randDelta(x)
Timo
regards, Richard
--
sic gorgiamus allos subjectatos nunc
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription opt
g out useful
code.
What the best way to test if something's an integer?
a = 4
isinstance(a, int)
True
isinstance(3., int)
False
What if I wanted 3., 1234., etc. to be considered ints, as they are by
_validate_int() ?
>>> isinstance(3., (int,
esults with the mechanize package in the past.
Timo
Ben
On Jun 13, 2012, at 8:27 AM, Walter Prins wrote:
Hi,
On 13 June 2012 13:35, Benjamin Fishbein <mailto:bfishbei...@gmail.com>> wrote:
Hello. I have been teaching myself Python and have been stuck on
this problem for a week--I
application that is written in Python 2.7 and
compiled with Py2exe, so it's possible.
When looking at the downloads, there are -py2.7 versions available:
http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/
Timo
Thanks in advance.
__
Op 25-04-12 06:41, Lion Chen schreef:
Hi, All,
Hi, please fix your formatting, the indentation is a big mess and makes
it impossible to read. You should also ask your question on the PyGTK
mailing list, not here.
first thanks the people who gave helps to me, :)
now i encountered another que
up that will explain
these things.
Timo
-Ganesh
Did I learn something today? If not, I wasted it.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/ma
Op 08-02-12 20:20, Brad Hudson schreef:
Thanks for the responses Alan & Modulok. I will start with SQLAlchemy
and see where it takes me.
I was looking for something similar a couple of months ago and chose to
use SQLObject over SQLAlchemy. In my eyes it was much easier to use.
sing too many arguments for a
format string.
>>> msg = 'one arg %s and a second %s'
>>> msg % ('foo', 'bar', 'baz') # Pass 3 arguments
Traceback (most recent call last):
File "", line 1, in
TypeError: not all arguments converted
reached = True
if line == 'model 1':
break
if first_reached:
result.append(line)
print result
Cheers,
Timo
above is a very simple example,
Thanks for any advice,
Best,
___
Tutor maillist - Tutor@python.org
To unsu
explains how to read the output below, but you made a little
error here.
Let's have a little example:
>>> x1 = 1
>>> x2 = x1 + 1
>>> print(x1 - x2)
-1
>>> print(x2 - x1)
1
So you should substract mydatetime from mydatetime2, not the other way
around.
C
t the works to blink, but I can get them to
appear for a short time:
from livewires import games, color
Looks like you're not using pygame, but livewires. Why not try their
mailinglist, I bet their knowledge is better than this *Python
beginners* list.
Cheers,
Timo
games.init(screen_w
Op 08-12-11 10:03, sunil tech schreef:
/Can i copy the content if a dictionary in to another variable, with
out any link between the dictionary & the variable?
/
Have a look at the copy module [1], or use the builtin dict.copy() method.
Cheers,
Timo
[1] http://docs.python.org/lib
ython
interpreter to run Python programs?
Cheers,
Timo
1. Why doesn't python doesn't offer executable file ?
2. If one wants to make a commercial software using python, how can he
hide the code?
3. However, if one wants to make an open source software, as python
doesn't offer execu
th respect to the == operator like that, and for good
reason. What you want is either this:
if name[0] == "m" or name[0] == "f" or name[0] == "b":
or, more idiomatically, you can use the in operator like this:
if name[0] in ("m", "f", "b&q
other source.
Cheers,
Timo
Thanks again,
--
André Engels, andreeng...@gmail.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/
don't have Windows, so can't test, but according to this Microsoft
page [1], you can give some comandline parameters to WMP.
Cheers,
Timo
[1] http://support.microsoft.com/kb/241422/en-us
from pywinauto import application
app = application.Application()
try:
wmp =
questions
answered is pretty small here.
Cheers,
Timo
Thanks for the help.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
__
et the latest GTK/PyGTK versions
from the PyGTK website. There is a really nice all-in-one installer!
Cheers,
Timo
class MainWin:
def __init__(self):
self.widgets = gtk.glade.XML("ejemplo_glade.glade")
signals = { "on_entry1_activate" : sel
I tried with zip(), but get a list of tuples, which isn't the desired
output. Anyone with a solution or push in the right direction?
Cheers,
TImo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
transition
import tlib as std
in tlib.__init__, include the following:
import html
htmlButton = html.button
And print a deprecation warning when people use it like this. That way
you let them know this method could be removed in a next version.
See the warnings module.
Cheers,
Timo
On 02-08-11 17:40, Thirupathaiah Gande (tgande) wrote:
Hi,
I have Python 2.3.4.
Is there some reason for this? You probably should update to 2.7 if
possible.
Then have a look at the Subprocess module documentation. There are some
examples which should get you on the way.
Cheers,
Timo
I
er = random.randint(1, 2)
if the_number == 1:
heads += 1
else:
tails += 1
counter += 1
print("\nI flipped the coint 100 times.")
print("It came up heads", heads, "times and tails", tails, "times.")
print("\n\nPress the
case of opening an
existing file).
I already installed Python a second time, but this also does not help.
Has anybody an idea how to fix this problem?
Thanks and all best
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
the user's configuration directory.
Which works pretty good.
Do have a good look though at the documentation or find some examples
through your search engine, because the above line won't work at all.
Cheers,
Timo
___
Tutor maillist - Tutor@pytho
Google before asking here? Because the
first hit when searching for "python html to pdf" looks like it should
do what you want.
Cheers,
Timo
--
Thank you
Arun Kumar
http://clicknscroll.blogspot.com
___
Tutor maillist - Tutor@pyt
.
You could also look at the program Emesene, they have a feature to login
to GTalk.
Cheers,
Timo
Advices too would be of great help..
Thanks.
--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com <http://www.dudupay.com>
Mobile Banking Solutions | Transaction
et_parsers() everytime the user clicks a
button? Because that will initialize the parsers over and over again, right?
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
nment. The reason why you can
just enter a program name in the terminal, is because these should be in
/usr/bin or /usr/local/bin and these are in PATH.
Type this in the terminal to see which ones:
echo $PATH
You can either put your script in one of those directories or add on to
PATH.
Cheers,
t gracefully, you can replace:
except:
print 'An error occured.'
with:
except Exception, exc:
print 'An error occured:\n' + exc
Cheers,
Timo
If that doesn't help you fix the problem, then remember the three
things you need:
1. What did I do?
2. Wh
so the user can change the data.
Cheers,
Timo
Anyone have any suggestions?
Thanks,
Bodsda
Sent from my BlackBerry® wireless device
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman
statement here to see what 'x' really is:
print repr(x)
Cheers,
Timo
if x == "a":
print ("a")
elif x == "b":
print ("b")
else:
print ('c')
___
Tutor maillist - Tutor@python.org
;
> [snip]
>
>
> What is wrong here? What do I need to change?
Check the line before the line which throws a syntax error. Have a good
look at it and you will see you are missing a character.
Cheers,
Timo
> Thanks! Quick reply will be much appreciated because the deadline is
>
hy is this?
The error says why this is. The function ctime() isn't in the datetime
module. You should have a look at the documentation [1] where you can
see that ctime is a method for the date object [2] or the datetime
object [3].
Cheers,
Timo
[1] http://docs.python.org/library/dat
Gedit. You can tweak it very nicely so it shows linenumbers and so on.
There are also very useful plugins. It is all I ever use and when I need
to write some code in Windows, it bugs me how bad IDLE really is.
Cheers,
Timo
Thanks for your time,
JC Knoll
_
s like a perfect place to commit changes.
But to be sure, it is perfectly safe and valid to open the database on
program startup, commit changes during the process and close it on exit
(or unhandled exception)?
Cheers,
Timo
There's no "one fits all feet" rule for such things - as y
tion if my application
starts, and commit and close when the user quits.
Is this save? Can data be selected if I haven't commit anything?
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://
easy-peasy way to get a list of names used in the standard library
(I am thinking to something like "dir()"?
This is the webpage I always use for searching an appropriate module:
http://docs.python.org/modindex.html
Cheers,
Timo
Mac.
___
("org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer")
bus_object.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
This will shutdown your computer immediatly. You can substitute the
"Shutdown" method with "Suspend", "Hibe
eat. But how could I remember this
class to call "class.shutdown = True" any given time when I press the stop
button?
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ption to put it on my own.
Cheers,
Timo
On Fri, Oct 1, 2010 at 2:49 PM, Timo <mailto:timomli...@gmail.com>> wrote:
Hello,
I have the following idea, but no clue how to implement this.
I want my users to be able to connect to other users (with the
same program) and
know
where to start or that I'm even at the right path.
So if anyone can point me into the right direction of a framework or
protocol I should use for this, it would be appreciated.
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe
, i in enumerate(l):
... print('%s. %s' %(index, i))
...
0. 1
1. 2
2. 3
3. 4
etc.
Cheers,
Timo
I tried changing the append to l.append(i+1)
which almost worked but the output started with 1. 2 I was curious
what happend to the 0. 1 line
I know this means that I'm not underst
quot;,.!";:")
You need to escape the quote between the quotes:
>>> word.strip(".,!\";:")
Timo
Roelof
___
Tutor maillist
7;bar'
You need to escape the quotes with a backslash, like:
>>> s = 'foo\'bar'
>>> print s
foo'bar
Cheers,
Timo
So I think I go for the suggestion of Bob en develop a programm which deletes all
the ' and " by scanning it character by char
version for example) or ask your webhost.
You can also put this on top of your script, so it shows you a nice
Python traceback instead of an error:
import cgitb
cgitb.enable()
Cheers,
Timo
test-working.py: this works on both laptop & server
http://pastebin.com/iLNTrGdW
both avail
ve
prompt:
>>> year = input(u'Introduce el año:')
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
position 14: ordinal not in range(128)
Cheers,
Timo
I believe th
13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import getpass
>>> s = getpass.getpass("Enter your word here: ")
Enter your word here:
>>> print s
blah
Cheers,
rfect, but it just doesn't
seem right for some reason.
You also posted this on the PyGTK mailing list, which is the correct
place for these problems. Please post your PyGTK questions only there,
do not double post. I'll answer you there.
Cheers,
Timo
Lang Hurst wrote:
I hope tha
t = form['text'].value
Now I can use 'text' on the server, for mailing etc. But I really can't
manage to do this with a file.
Anyone can give me a helping hand here?
Cheers,
Timo
___
Tutor maillist - Tutor@python.
l with that. See the PyGTK reference
manual and see the widgets that start with "Recent*".
Cheers,
Timo
Thanks,
John S.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pyt
2010/3/25 Timo
> Hello,
>
> I was wondering what the best way is to send an email through my program? I
> want the user to send an email with an attachment.
>
> I do have a webspace, should I use the smtplib module if my webhost
> supports it (I have to ask though), or sho
that?
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ces, and it is located in the same folder as where the database should
be.
So if the folder wasn't writeable, the creation of the logfile would have
caused an error too.
So I'm a bit stuck about this one.
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ld be.
Hmm that's strange. I thought the application data folder is the correct
folder on Windows systems to put your configuration files. And until
now, it worked perfectly for every user.
What should be the correct folder then?
Cheers,
Timo
the error are Russian, so I thought
that the Russian characters would cause problems. I tried on my Linux
and Windows machines with some Russian names, but thet doesn't seem the
problem.
Some help is appreciated :-).
Cheers,
Timo
___
Tutor maillis
2000 to
Windows 7 without installing anything else (like Python).
Try GUI2exe for a nice graphical interface.
Cheers,
Timo
Thanks you,
Harya Dananjaya
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
I read that it is advised to subclass object.
Is it really necessary? I mean, everything works, why should I add it to my
code?
Cheers,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org
Op 25-12-09 17:49, rick schreef:
I'm working my way through Mr Lutz's "Learning Python", and I come to
this snippet (page 271):
while True:
reply = input('Enter text:')
Try this:
reply = raw_input('Enter text: ')
Cheers,
Timo
I find regular expressions alwys hard to get, so here is my solution:
>>> import glob
>>>
glob.glob('C:\\Users\\blueman\\Desktop\\allFiles\\MyTest[0-9].[0-9].zip')
Cheers,
Timo
MARCUS NG schreef:
Hi all,
I am really new to python and I am trying to create
Dave Angel schreef:
Timo List wrote:
For my program I disable the py2exe log feature by routing output to the
nul-file.
Code:
if win32 and py2exe:
sys.stdout = open("nul", "w")
sys.stderr = open("nul", "w")
This always
ail from a user with the following error:
IOError: [Errno 2] No such file or directory: 'nul'
Now, I thought the nul-file always existed, shouldn't it?
Is there another way to disable output, if this one fails?
Cheers,
Timo
___
Tutor
Thanks for all the answers.
I'm using SQLite as database and will try the ROWID.
Timo
Modulok schreef:
I'm writing an application which will hold a database of people. Ofcourse,
people can have the same name, so I want to stock them with an unique ID.
I've searched and fo
d().
What should I use the best for this? Maybe examples of other programs that
do something alike?
Thanks,
Timo
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
proportio...@msn.com schreef:
hi, thanks to all that helped with my list question yesterday. i have
now finished my program the way i want it. is there a way to compile
my program so that people without python can see what i have made?
Works great with py2exe.
Timo
I have written a program that uses a C++ module as backend. Now I found
out that I can use Python to call an underneath C lib. That's nice, so I
don't need to Popen() the C++ module.
I have a problem though with some info that is returned (always an integer).
I'll try to explain a bit, this is
Hello all,
At the moment I'm using 3 files as datastorage for my program. One file
using ConfigParser and two use the Pickle module.
File one contains for example:
[ID]
option1 = string1
option2 = string2
option3 = string3
And is connected to one of the Pickle files which is like this:
{ID : [{k
Emile van Sebille schreef:
On 5/13/2009 9:25 AM Timo said...
Hello,
I don't think this should be difficult, so maybe I look over it. But
I can't seem to find the solution.
I have a list with one word and a couple of numbers.
If this is always the case you can use the sort metho
7;, 3, 9]
should be:
['word', 3, 4, 6, 9]
Timo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Kent Johnson schreef:
On Tue, May 12, 2009 at 4:00 AM, Timo wrote:
Kent Johnson schreef:
Try the pickle module.
I went from Pickle to Shelve because I couldn't store my wanted list of
dictionaries in Pickle.
What was the problem? You should be able to create a
Kent Johnson schreef:
On Tue, May 12, 2009 at 3:59 AM, Timo wrote:
Alan Gauld schreef:
"Timo" wrote
I have an issue with the Shelve module. It works great for my needs, the
only problem is that a file made with Shelve isn't interchangable between
diff
Kent Johnson schreef:
On Mon, May 11, 2009 at 1:39 PM, Timo wrote:
Hello all,
I have an issue with the Shelve module. It works great for my needs, the
only problem is that a file made with Shelve isn't interchangable between
different computers. I want my data to be exchanged between
Alan Gauld schreef:
"Timo" wrote
I have an issue with the Shelve module. It works great for my needs,
the only problem is that a file made with Shelve isn't interchangable
between different computers.
I thought it would be.
What kind of computers are you having issues with
1 - 100 of 119 matches
Mail list logo