>Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers >of each card(the position in the list)? Then delete
a certain card or cards, based upon the >user's choice?.
hope this points you in the right direction Nathan.
-Luke
#start of program
#--
Nathan,
> for site,ID,passcard in sitelist.items():
> ValueError: need more than 2 values to unpack
The line is asking a dictionary (sitelist) to return 3 values
(site, ID and passcard) from its items() method. But A dictionary
stores things as name/value pairs so you can only get 2 items
bac
Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers of each card(the position in the list)? Then delete a
certain card or cards, based upon the user's choice?.
Nathan
---Early to
bed,Early
I fixed it. The problem was this line:
ID = line.strip().strip()
I fixed it so that it now reads:
ID = store.next().strip()
As a result, the program runs perfectly.
Nathan Pinno
---
Early to bed,
Early to rise,
Makes a man healthy, wealt
Quoting Nathan Pinno <[EMAIL PROTECTED]>:
> I tried fixing it. Here is the new code:
There are two likely places where you could have a problem: In your save
function, or in your load function. Have you tried looking at the file where it
saved the information? If the file doesn't contain the da
I tried fixing it. Here is the new code:
#This is for a password protected program to store passwords.
import getpass
password = "hello"
sitelist = {}
def load_file(pw):
import os
filename = 'passcard.txt'
if os.path.exists(filename):
store = open(filename,'r')
for line
Hi, Sorry for the subject a bit generic. This question comes from a
simple program I'm doing. I could have a working solution, but
considering my inexperience, I'm just asking if my approach is
acceptable.
This is a simple class to manage (actually to create and save)
categories of things. Categor
I think it means that I can't store the data as a dictionary unless I store
both the username and passcard as username|passcard. Am I right?
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
Quoting Nathan Pinno <[EMAIL PROTECTED]>:
> Here is the error:
>
> Traceback (most recent call last):
> File "D:\Python24\password.py", line 91, in -toplevel-
> save_file(sitelist)
> File "D:\Python24\password.py", line 22, in save_file
> for site,ID,passcard in sitelist.items():
> ValueError
Here is the error:
Traceback (most recent call last): File
"D:\Python24\password.py", line 91, in -toplevel-
save_file(sitelist) File "D:\Python24\password.py", line 22, in
save_file for site,ID,passcard in
sitelist.items():ValueError: need more than 2 values to unpack
Here is th
> print random.choice(cool)
> What can I do with it, other than let it be a fun example of coding?
Make a Magic 8 ball! :^)
Alan
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I coded the following just for fun:
import randomcool = ['Cool math!','Awesome!','Way to go!','Happy
problem solving!']while 1: start = raw_input("Do you
want to do some math? Yes or No") if start ==
"Yes": x = int(raw_input("First
number:")) y =
int(raw_input("Second
> Nathan.
>---
> Early to bed,
> Early to rise,
> Makes a man healthy, wealthy, and wise.
>--Benjamin Franklin
>---
> P.S. Is this signature better than the last one?
There w
Quoting Dan Deternova <[EMAIL PROTECTED]>:
> ok. i know python and want to turn all my programs i made when i was
> learning python into Tkinter programs. i dont know how to make if
> satments and display the output like this in python:
> if cmd == quit:
> print "press exit to quit"
> i have n
Nathan Pinno said unto the world upon 2005-08-09 17:35:
> It printed 25.973 as the result.
>> I don't think I got the math wrong. My thinking is there are 52**6
>> ways to choose 6 items from 52 if you don't care about duplicates, and
>> 52*51*50*49*48*47 ways to choose if you do. (The first
ok. i know python and want to turn all my programs i made when i was learning python into Tkinter programs. i dont know how to make if satments and display the output like this in python:
if cmd == quit:
print "press exit to quit"
i have no idea how to do that in Tkinter please help.
It printed 25.973 as the result.
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
---
- Original Message -
From: "Brian va
Nathan Pinno said unto the world upon 2005-08-09 15:35:
> Hey all,
>
> I just fixed it so that it prints. The problem was that it returned the
> cards instead of printing them.
>
> Nathan
>
>> Hey Brian and all,
>>
>> Just coded in and tried your program Brian. Doesn't print a thing.
>>
Thanks Luke. You've helped me out of a jam that I was going to ask without
even asking.
Nathan
---Early to
bed,Early to rise,Makes a man healthy, wealthy, and wise.--Benjamin
Franklin
hi all,
just wanted to announce my next public Python course. it's
a 3-day course held near the San Francisco airport. please
sign up quickly as there are only 10 more open spots! let
me know if you have any questions.
the website is http://cyberwebconsulting.com (click "Python
training"), but
Michael and List,
You suggestion (see foot of email trail, below) is a bit over my head. As
I stated, I removed ActivePython 2.4.1 installed Python 2.4.1 from
python.org, and now my program doesn't work, where before it did. I don't
understand this. When isn't Python 2.4.1 == Python 2.4.1? I
Hey all,
I marked it off-topic, but it is necessary to mail this to the mailing
list. People asked questions when I first put up my blackjack game(the beginning
code of it anyway), so here is a site that has the rules of card games, since
I'll be writing them on Python.
It's http://www.pa
Hey all,
I just fixed it so that it prints. The problem was that it returned the
cards instead of printing them.
Nathan
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
--
Hey Brian and all,
Just coded in and tried your program Brian. Doesn't print a thing.
I thought the odds were more like 6/52! or 1/(1.3443029195*10^84).
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin
> "ky = chr(msvcrt.getch())". The other problem is that when
> the program is finished the previous terminal state is not
> restored (I am using xterm on Linux).
Yep, and that applies to my cygwin terminal too. I think there
is a setty command you can issue that fixres this but since I
hardly ev
Got it!
Because 'menu' is a config option of the top level window's config but not
of 'Frame', It's just a matter of calling self.master.config(menu=menu)
Thanks
j.
>From: Kent Johnson <[EMAIL PROTECTED]>
>To: Python Tutor
>Subject: Re: [Tutor] Tkinter Menus
>Date: Tue, 09 Aug 2005 07:39:35 -0
Ron Phillips wrote:
> I am expecting users to cut-and-paste DMS data into an application —
> like: +40 30 15 E40 15 34.56, -81 0 0, 81 57 34.27E, W 40° 13’
> 27.343”, 40° 13’ 27.343” S, 140° 13’ 27.343”S, S40° 13’ 27.34454,
> 81:57:34.27E
>
> I've been able to write a regex that seems t
I am expecting users to cut-and-paste DMS data into an application like: +40 30 15 E40 15 34.56, -81 0 0, 81 57 34.27E, W 40° 13 27.343, 40° 13 27.343 S, 140° 13 27.343S, S40° 13 27.34454, 81:57:34.27E
I've been able to write a regex that seems to work in redemo.py, but it doesn
Ah, sorry. Here is the definition of fCanvas:
class LogAnalyzerGUI(Frame):
def __init__(self, parent=0):
Frame.__init__(self, parent)
self.type = 2
self.terms = 0
self.master.title('XML Analyzer')
self.buildUI()
def buildUI(self):
fCanvas = Frame(self)
Label(fCanva
Kent Johnson wrote at 06:13 8/9/2005:
>Dick Moores wrote:
> > Win XP. Python2.4.
> >
> > Javier Ruere suggested getting PyChecker or PyLint. I found PyChecker
> and
> > put the pychecker-0.8.14 folder in
> > C:\Python24\Lib\site-packages\PyChecker. I don't really know what I'm
> > doing (obviously
Hi,
I'd like to pack some modules in a package. Each module contains a single
class, which forces me to
from Pythonsite.Show import Page
page = Page()
...
class Page(Site.DB): #class DB from module Site in package Pythonsite
...
Is there a way to define a default class for a module whi
I had a look at urllib2 and I found this example :-
import urllib2
# Create an OpenerDirector with support for Basic HTTP
Authentication...
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password('realm', 'host', 'username',
'password')
opener = urllib2.build_opener(auth_handler)
#
oliver wrote:
> On 8/9/05, Øyvind <[EMAIL PROTECTED]> wrote:
>
>>Thanks a lot. However, it didn't work. I got an error stating something
>>along: "Is not recognized as an internal or external command, executable
>>program or .. file" (I don't know how to translate the word . to
>>english).
Dick Moores wrote:
> Win XP. Python2.4.
>
> Javier Ruere suggested getting PyChecker or PyLint. I found PyChecker and
> put the pychecker-0.8.14 folder in
> C:\Python24\Lib\site-packages\PyChecker. I don't really know what I'm
> doing (obviously?), but I added
> C:\Python24\Lib\site-packages\P
On 8/9/05, Øyvind <[EMAIL PROTECTED]> wrote:
> Thanks a lot. However, it didn't work. I got an error stating something
> along: "Is not recognized as an internal or external command, executable
> program or .. file" (I don't know how to translate the word . to
> english).
That looks like a
Øyvind wrote:
> Hello.
>
> I need to run a program
> (http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)
> thru Python. It is normally run such as "uptime AUTO-SRV-001 /s
> /d:04/01/2005" in the command prompt. Is it possible to run a already
> compiled exe file in Pyth
Thanks a lot. However, it didn't work. I got an error stating something
along: "Is not recognized as an internal or external command, executable
program or .. file" (I don't know how to translate the word . to
english).
But, when I looked in the manual about the commands module, I found th
Brian van den Broek wrote:
> Say you go with your method of defining a deck (cards above) and then
> making random choices from it. Try something like this (untested code):
>
> cards = ["Ace of ...",] # As above
> cards_dealt = []
> def get_card():
> while True:
> new_card = random
>>> import commands
>>> commands.getoutput("uptime AUTO-SRV-001 /s /d:04/01/2005")
that should do itOn 8/9/05, Øyvind <[EMAIL PROTECTED]> wrote:
Hello.I need to run a program(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)thru Python. It is normally run such as "upti
Dear Alan
Hi,
First of all let me thank you very much for that excellent
tutorial. As a Python beginner, I learned many things from that.
As I have mentioned in my previous message to this list, in
that example I had to replace "ky = msvcrt.getch()" with
"ky = chr(msvcrt.getch())
Win XP. Python2.4.
Javier Ruere suggested getting PyChecker or PyLint. I found PyChecker and
put the pychecker-0.8.14 folder in
C:\Python24\Lib\site-packages\PyChecker. I don't really know what I'm
doing (obviously?), but I added
C:\Python24\Lib\site-packages\PyChecker\pychecker-0.8.14\pycheck
Hello.
I need to run a program
(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)
thru Python. It is normally run such as "uptime AUTO-SRV-001 /s
/d:04/01/2005" in the command prompt. Is it possible to run a already
compiled exe file in Python and thereafter get the re
Jorge Louis De Castro wrote:
> Hello,
>
> I'm having this issue with Tkinter. I have a frame with all my buttons,
> checkboxes et al, and all is working fine. I want to add menus and added the
> following to my frame (fCanvas) code:
>
> # create a toplevel menu
> menu = Menu(fCanvas)
>
David Holland wrote:
> Alan,
>
> Sorry of course that is the problem. These pages are
> password protected
> Is it possible to download password protected pages (I
> know the password but I don't how to get the program
> to use it).
urllib2 supports basic and digest authentication. There a
Alan G wrote at 03:22 8/9/2005:
>>I tried deleting a mycalc.pyc that had been created and the problem
>>cleared up! If I remember correctly, for a while I had moved mycalc.py
>>to another folder in PYTHONPATH (I had recently learned how to modify
>>PYTHONPATH in Win XP), and the .pyc was in this
On 8/9/05, Tom Cloyd <[EMAIL PROTECTED]> wrote:
> print len('()ÄäÀÁàáÇçÈÉèéÌÍìíÑñÒÓòóÙÚúù')
> print len('--AaAAaaCcEEeeIIiiNnOOooUUuu')
>
> the result:
>
> 54
> 28
>
> I'm completely mystified by this. All of it. None of it makes sense. This
> program was working fine. Now it doesn't. And those
> I tried deleting a mycalc.pyc that had been created and the problem
> cleared up! If I remember correctly, for a while I had moved
> mycalc.py to another folder in PYTHONPATH (I had recently learned
> how to modify PYTHONPATH in Win XP), and the .pyc was in this
> folder. Sorry I don't rememb
Hello,
I'm having this issue with Tkinter. I have a frame with all my buttons,
checkboxes et al, and all is working fine. I want to add menus and added the
following to my frame (fCanvas) code:
# create a toplevel menu
menu = Menu(fCanvas)
fCanvas.config(menu=menu)
# create a pu
Alan G wrote at 00:42 8/9/2005:
>Dick,
>
>I can't see a problem but I notice an inconsistency below:
>
>>#testof_cmpSeq.py
>>import mycalc
>
>>which produces:
>>
>>Traceback (most recent call last):
>> File "C:\Python24\MyScripts\testof_cmpSeq.py", line 1, in -toplevel-
>> from mycalc import
List,
I'm running a program I wrote which I've run a number of times before,
successfully.
I use the following statement to fix the problem of utf-8 codes which blow
up a later part of my production process that I cannot fix:
trans_table =
maketrans('()ÄäÀÁàáÇçÈÉèéÌÍìíÑñÒÓòóÙÚúù','--AaAAaa
Dear Danny
Hi,
Many thanks for your help and especially the references in your
reply. Now the code works fine.
BTW, I had to replace "ky = msvcrt.getch()" with
"ky = chr(msvcrt.getch())".
Regards,
Hossein
On Mon, 8 Aug 2005, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 8 Aug
> Sorry of course that is the problem. These pages are
> password protected
> Is it possible to download password protected pages (I
> know the password but I don't how to get the program
> to use it).
That will depend on how the protection is implemented.
If your server is a J2EE box with
Alan,
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
David
--- Alan G <[EMAIL PROTECTED]> wrote:
> > It runs fine but the file saved to disk is
Hi Dan,
I think you need to back up a little and build the program piece by
piece.
> i am making a simple script to get the hang of Tkinter.
The script is quite complex for a starter. You could focus down on
just
a single control initially, the area button. Get that to pop up the
dialog
and
Dick,
I can't see a problem but I notice an inconsistency below:
> #testof_cmpSeq.py
> import mycalc
> which produces:
>
> Traceback (most recent call last):
> File "C:\Python24\MyScripts\testof_cmpSeq.py", line 1,
> in -toplevel-
> from mycalc import cmpSeq
> ImportError: cannot import n
>>I have copied the following example from "Learning to Program by
>> Alan
>> Gauld (section: Event Driven Programming)". To run it on Linux
>> (Redhat 8.0; Python 2.4) the tutorial says to replace 'msvcrt'
>> with 'curses.stdscr'.
I thought I'd fixed that fault.
The sequence should be:
56 matches
Mail list logo