Re: Having both if() and for() statements in one liner

2013-09-17 Thread Dave Angel
On 17/9/2013 09:21, Ferrous Cranus wrote: > I just want to say tot he program that > > that only run the for statement if and only if person=='George' > > I dont see nay reason as to why this fails > > perhaps like: > > for times in range(0, 5) if person=='George': > > but that fails too... > the

Re: How do I calculate a mean with python?

2013-09-16 Thread Dave Angel
On 16/9/2013 19:33, William Bryant wrote: > Hey I am new to python so go easy, but I wanted to know how to make a program > that calculates the maen. > > List = [15, 6, 6, 7, 8, 9, 40] > def mean(): > global themean, thesum > for i in List: > thecount = List.count(i) > the

Re: import problem

2013-09-16 Thread Dave Angel
On 16/9/2013 00:05, Mohsen Pahlevanzadeh wrote: > thank you, you gave me "how to get fish" instead of "fish", it's very > better. I'd suggest you make a diagram showing each file and indicate what files it imports by an arrow. If any arrows form a circle, you (may) have recursive imports. You s

Re: Python GUI?

2013-09-15 Thread Dave Cook
eworks in the sense of, say, Django. Enthought has some interesting GUI framework projects which I haven't tried: http://code.enthought.com/projects/ Dabo would be another example. Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get time (milisecond) of a python IO execution

2013-09-15 Thread Dave Angel
On 14/9/2013 22:59, Tal Bar-Or wrote: > Hi All > > i am trying to test measure some IO execution in milliseconds , but bit > confuse about best method achive that under windows 7 Measuring any performance can be tricky, and I/O in particular. Windows will cache the recently used file informatio

Re: Monitor key presses in Python?

2013-09-14 Thread Dave Angel
On 14/9/2013 14:10, eamonn...@gmail.com wrote: > I didnt wanna say that, in case people threw a fit and stuff. > > So yeah, how would I monitor the key presses? There's a huge difference between monitoring key presses within your own process, and intercepting them system-wide. if you need to see

Re: Python GUI?

2013-09-13 Thread Dave Angel
On 13/9/2013 15:37, eamonn...@gmail.com wrote: > I disagree with you. It's not hard, and I apologise if its ever sounded that > way, but it is the fun part for me. I love spending hours(days even) > debugging. > > Well, thanks all for depressing me. Time to give up programming and find > someth

Re: Python GUI?

2013-09-12 Thread Dave Cook
On 2013-09-12, Robert Kern wrote: > There is nothing forcing you to use the GUI designers if you don't want to. There's also a markup language available, enaml: http://docs.enthought.com/enaml/ Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re: Python GUI?

2013-09-12 Thread Dave Cook
On 2013-09-12, Dave Cook wrote: > There's also a markup language available, enaml: > > http://docs.enthought.com/enaml/ I should have mentioned that it's *Python*-based markup, not an XML horrorshow. http://pyvideo.org/video/1231/enaml-a-framework-for-building-declarat

Re: Python GUI?

2013-09-12 Thread Dave Cook
f signals and slots is by far the most powerful and > flexible. wxPython's event manager adds some flexibility. Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re: Parsing an html line and pulling out only numbers that meet a certain criteria

2013-09-12 Thread Dave Angel
On 11/9/2013 23:03, Cory Mottice wrote: > I am using line.rfind to parse a particular line of html code. For example, > this is the line of html code I am parsing: > > 79° class="low">Lo 56° > > and this is the code I use to split the line to (in this case) pull out the > '79'. > > position0 = l

Re: Accessing class attribute

2013-09-12 Thread Dave Angel
On 12/9/2013 02:15, chandan kumar wrote: > Hi , > > I'm new to python Welcome. I hope you enjoy your time here, and that the language treats you as well as it's treated me. > ,please correct me if there is any thing wrong with the way accessing class attributes. None of the following uses class

Re: global variable across modules

2013-09-11 Thread Dave Angel
On 11/9/2013 17:49, John Pote wrote: > Chris, > Interesting. >> >> # Test1.py >> Debug_Value = " " >> >> # Test2.py >> from Test1 import * >> # is exactly equivalent to >> Debug_Value = " " >> > I take it then that assigning to Debug_Value in Test2.py will not change the > value of Debug_Valu

Re: Help please, why doesn't it show the next input?

2013-09-11 Thread Dave Angel
On 11/9/2013 15:31, William Bryant wrote: > @Dave Angel > > What is .lower() ? It is a method on the str class. You could teach yourself. At the interpreter prompt, type >>>> help("test response".lower) Or on the web: http://docs.python.org/2/library/stdtypes

Re: Send alt key to subprocess.PIPE stdin

2013-09-11 Thread Dave Angel
On 11/9/2013 10:26, Wanderer wrote: > How do I send the command 'Alt+D' to subprocess.PIPE? That's not a command, it's a keystroke combination. And without knowing what RSConfig.exe is looking to get its keystrokes, it might not even be possible to feed it any keystrokes via the pipe. if the pr

Re: global variable across modules

2013-09-11 Thread Dave Angel
On 11/9/2013 08:50, chandan kumar wrote: > Hi , > > I'm trying to understand using global variable across different modules. Python doesn't have such a thing, unless you consider builtins. > Here is what i have tried so far without much success.Please ignore any > indentation issue  in the below

Re: Language design

2013-09-11 Thread Dave Angel
On 11/9/2013 07:42, Wayne Werner wrote: > On Tue, 10 Sep 2013, Ben Finney wrote: >> The sooner we replace the erroneous >> “text is ASCII” in the common wisdom with “text is Unicode”, the >> better. > > I'd actually argue that it's better to replace the common wisdom with > "text is binary dat

Re: Help please, why doesn't it show the next input?

2013-09-11 Thread Dave Angel
On 11/9/2013 01:39, William Bryant wrote: > On Wednesday, September 11, 2013 5:11:23 PM UTC+12, John Gordon wrote: >> In William Bryant >> writes: >> >> >> >> > Hey, I am very new to python, I am 13 years old. I want to be able to make >> > = >> >> > a program the caculates the mean, meadi

Re: Dealing with Lists

2013-09-10 Thread Dave Angel
On 10/9/2013 22:14, Steven D'Aprano wrote: > On Tue, 10 Sep 2013 14:08:45 -0700, stas poritskiy wrote: > >> Greetings to all! >> >> i ran into a little logic problem and trying to figure it out. >> >> my case is as follows: >> >> i have a list of items each item represents a Group >> i need to

Re: Dealing with Lists

2013-09-10 Thread Dave Angel
ow what that means either. > > So head is parent of neck, while neck is parent of arms and so on. They're just strings, not parents of anything. But the real question is whether that list I described is what you wanted: ["head", ["neck", ["arms", ["leg

Re: Dealing with Lists

2013-09-10 Thread Dave Angel
On 10/9/2013 17:08, stas poritskiy wrote: > Greetings to all! > > i ran into a little logic problem and trying to figure it out. > > my case is as follows: > > i have a list of items each item represents a Group > > i need to create a set of nested groups, > > so, for example: > > myGroups = ["he

Re: Monitor key presses in Python?

2013-09-09 Thread Dave Angel
On 9/9/2013 13:39, eamonn...@gmail.com wrote: > Is there a way to detect if the user presses a key in Python that works on > most OS's? I've only seen 1 method, and that only works in Python 2.6 and > less. If you get the key, can you store it in a variable? > > Also, is there a way to create a

Re: Can I trust downloading Python?

2013-09-07 Thread Dave Angel
On 7/9/2013 21:17, Aaron Martin wrote: > Hi, I am thinking about getting a software but it requires python, so that > brought up a few questions. Is it safe do download python, and does it come > with spam or advertisements? If it doesn't then should I get the latest > version? I mostly want to kn

Re: Multiprocessing / threading confusion

2013-09-06 Thread Dave Angel
On 6/9/2013 14:27, Paul Pittlerson wrote: f> Ok here is the fixed and shortened version of my script: > > #!/usr/bin/python > > from multiprocessing import Process, Queue, current_process > from threading import Thread > from time import sleep > > class Worker(): > def __init__(self, Que): >

Re: Newbie question related to Boolean in Python

2013-09-05 Thread Dave Angel
On 5/9/2013 16:08, skwyan...@gmail.com wrote: > 1. bear_moved = False > 2. > 3. while True: > 4.next = raw_input("> ") > 5. > 6.if next == "take honey": > 7.dead("The bear looks at you then slaps your face off.") > 8.elif next == "taunt bear"

Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Dave Angel
On 5/9/2013 12:37, jsri...@gmail.com wrote: > I am going through the tutorials on docs.python.org, and I came across this > excerpt from http://docs.python.org/3/tutorial/controlflow.html: > > "The execution of a function introduces a new symbol table used for the local > variables of the functi

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Dave Angel
On 5/9/2013 05:36, Ferrous Cranus wrote: > > > ni...@superhost.gr [~]# cat /tmp/err.out > sendmail => 13-09-05 12:20:53 (, > TypeError("sendmail() missing 2 required positional arguments: > 'to_addrs' and 'msg'",), ) > ni...@superhost.gr [~]# > > but all of the needed args are within MESSAGE. >

Re: Find out where a class is used throughout a program.

2013-09-05 Thread Dave Angel
On 4/9/2013 12:32, Azureaus wrote: > Hi All, > I'm fairly new to Python so please forgive me If I sound confused or include > anything a bit irrelevant. I've had some great responses from this group > already though so thanks. > > I have a source file that is laid out roughly like > > class: > c

Re: UnicodeDecodeError issue

2013-09-04 Thread Dave Angel
On 4/9/2013 10:29, Ferrous Cranus wrote: > Στις 4/9/2013 3:38 μμ, ο/η Dave Angel έγραψε: >> 'file' isn't magic. And again, it doesn't look at the filename, it >> looks at the content. > So, you are saying that it looks a the content of the file and not o

Re: UnicodeDecodeError issue

2013-09-04 Thread Dave Angel
On 4/9/2013 07:38, Ferrous Cranus wrote: > Στις 4/9/2013 2:26 μμ, ο/η Dave Angel έγραψε: >> >>>> >>>> So first in the interpreter, I ran >>>> >>>> >>>> >>>>>>>> f = open("junk.txt", "w&q

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Dave Angel
On 4/9/2013 07:29, Ferrous Cranus wrote: > Στις 4/9/2013 2:15 μμ, ο/η Dave Angel έγραψε: >>> Τη Τετάρτη, 4 Σεπτεμβρίου 2013 5:14:31 π.μ. UTC+3, ο χρήστης Piet van >>> Oostrum έγραψε: >>>> Where does it display that? >>>> Do you happen to r

Re: how does not work nested comment in python?

2013-09-04 Thread Dave Angel
On 4/9/2013 02:13, vnkumbh...@gmail.com wrote: > example: > > print "hello" # print comment +"world"=> single line comment >>> print "hello" # print comment +"world"=> single line comment hello > print "hello" '''print comment''' +"world" => multiple line comment >>> print "hello"

Re: UnicodeDecodeError issue

2013-09-04 Thread Dave Angel
On 4/9/2013 04:35, Ferrous Cranus wrote: > Τη Δευτέρα, 2 Σεπτεμβρίου 2013 9:28:36 μ.μ. UTC+3, ο χρήστης Dave Angel > έγραψε: >> On 2/9/2013 11:05, Ferrous Cranus wrote: >> >> >> >> > Στις 2/9/2013 3:21 μμ, ο/η Dave Angel έγραψε: >> >> &g

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Dave Angel
On 4/9/2013 05:57, Ferrous Cranus wrote: > Τη Τετάρτη, 4 Σεπτεμβρίου 2013 5:14:31 π.μ. UTC+3, ο χρήστης Piet van Oostrum > έγραψε: > >> Where does it display that? >> Do you happen to read that mail in a Microsoft program? > > yes. Thunderbird. When did Microsoft take over Thunderbird's developm

Re: UnicodeDecodeError issue

2013-09-02 Thread Dave Angel
On 2/9/2013 11:05, Ferrous Cranus wrote: > Στις 2/9/2013 3:21 μμ, ο/η Dave Angel έγραψε: >> Starting with the byte string in the error message: >>>>> f = open("junk.txt", "w") >>>>> f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\x

Re: UnicodeDecodeError issue

2013-09-02 Thread Dave Angel
On 2/9/2013 07:56, MRAB wrote: > On 02/09/2013 12:38, Dave Angel wrote: >> ¶γνωστοόνομα συστήματος >> >> I don't have a clue what it might be; it's not English, and I don't >> know whatever language it may be in. >> > You don

Re: UnicodeDecodeError issue

2013-09-02 Thread Dave Angel
On 2/9/2013 07:49, Ferrous Cranus wrote: > Στις 2/9/2013 2:38 μμ, ο/η Dave Angel έγραψε: >> >> Does that string make any sense to you? > > Yes it does, it mean "Unknown Hostname" > >> The Linux 'file' utility thinks this string is in ISO-8859

Re: UnicodeDecodeError issue

2013-09-02 Thread Dave Angel
On 2/9/2013 00:16, Ferrous Cranus wrote: >> >> Have you tried to decode those bytes in various encodings other than >> utf-8 ? > > > No, because i wasn't aware of what string/variable they were pertaining at. > > http://pypi.python.org/pypi/chardet is a package which tries to 'guess' an encod

Re: UnicodeDecodeError issue

2013-09-01 Thread Dave Angel
On 1/9/2013 18:23, Ferrous Cranus wrote: >> > i still wonder how come the invalid byte messge dissapeared > Too bad you never bothered to narrow it down to its source. It could be anywhere on those three lines. If I had to guess, I'd figure it was one of those environment variables. The L

Re: UnicodeDecodeError issue

2013-09-01 Thread Dave Angel
On 1/9/2013 09:59, Ferrous Cranus wrote: > Στις 1/9/2013 1:35 μμ, ο/η Dave Angel έγραψε: >> This is my first crack at it (untested): >> >> errout = open("/tmp/err.out", "w") #opens and truncates the error >> output file >> try: >&

Re: UnicodeDecodeError issue

2013-09-01 Thread Dave Angel
On 1/9/2013 10:08, Ferrous Cranus wrote: > Here is it: > > > errout = open( '/tmp/err.out', 'w' ) # opens and truncates the error > output file > try: > gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') > city = gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or > g

Re: UnicodeDecodeError issue

2013-09-01 Thread Dave Angel
On 1/9/2013 03:23, Ferrous Cranus wrote: > Στις 1/9/2013 10:12 πμ, ο/η Chris Angelico έγραψε: >> On Sun, Sep 1, 2013 at 4:50 PM, Ferrous Cranus wrote: >>> Ye i'm aware that i need to define variables before i try to make use of >>> them. >>> I have study all of your examples and then re-view my

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Dave Angel
On 28/8/2013 07:38, Ferrous Cranus wrote: > > no this is the general error log apache produces for all the server. > > Is there a way to grep error logging info, pertainign only to my specific > nikos account or my superhost.gr domain? I now nothing about Apache logs, but how about grepping the

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Dave Angel
On 28/8/2013 07:14, Ferrous Cranus wrote: > > > But i cannot test it without looking at the error log which is scrolling like > hell and doesn't even quit with a ctrl+c I take it this 'error log" is shared with other users, and you can't constrain them to cease and desist for a while? > > How w

Re: split lines from stdin into a list of unicode strings

2013-08-28 Thread Dave Angel
On 28/8/2013 04:32, Kurt Mueller wrote: > This is a follow up to the Subject > "right adjusted strings containing umlauts" You started a new thread, with a new subject line. So presumably we're starting over with a clean slate. > > For some text manipulation tasks I need a template to split lin

Re: right adjusted strings containing umlauts

2013-08-28 Thread Dave Angel
On 28/8/2013 04:01, Kurt Mueller wrote: > Because I cannot switch to Python 3 for now my life is not so easy:-) > > For some text manipulation tasks I need a template to split lines > from stdin into a list of strings the way shlex.split() does it. > The encoding of the input can vary. > For furt

Re: Checking homogeneity of Array using List in Python

2013-08-25 Thread Dave Angel
sahil301...@gmail.com wrote: > I am unable to check homogeneity of Array. > I have take Array type Int to be default for my code. > > Instead of getting Error on NON-INT Values. But none of them below are int values. > I want to take input as string. > Then check if all input is in (0-9) form, I

Re: multifile programming on python 3

2013-08-25 Thread Dave Angel
Mohsen Pahlevanzadeh wrote: > Dear all, > > I need help about multifile programming on python 3 and i questioned on > stackoverflow : > http://stackoverflow.com/questions/18391230/eclipse-python-nameerror-name-mymodule-is-not-defined > > I thank you if you answer me. > > --mohsen You have a respo

Re: Help regarding urllib

2013-08-24 Thread Dave Angel
malhar vora wrote: > On Saturday, August 24, 2013 4:15:01 PM UTC+5:30, malhar vora wrote: >> Hello All, >> >> >> >> >> >> I am simply fetching data from robots.txt of a url. Below is my code. >> >> >> >> siteurl = siteurl.rstrip("/") > > Sorry for last complete. It was sent by mistake. > >

Re: Exception Handling Practices / Patterns

2013-08-24 Thread Dave Angel
snarf wrote: > Greetings, > > As I tread through my journey of OO I am trying to determine if there is a > good approach for exception handling within classes. > > From my readings and gatherings - it seems I have found a common theme, but I > am trying to solicit from the experts. > > Here is w

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread Dave Angel
David M. Cotter wrote: > Steven wrote: >> I see you are using Python 2 > correct > >>It's hard to say what *exactly* is happening here, because you don't explain >>how the python print statement somehow gets into your C++ Log code. Do I >>guess right that it catches stdout? > yes, i'm redirecting

Re: Using PyQT with QT Designer

2013-08-23 Thread Dave Angel
Michael Staggs wrote: > > That's the problem though. It is exactly how I want it in designer. It's > perfect as it is in designer when I preview it. Here is a screenshot of the > preview: http://i.imgur.com/ULRolq8.png > > The problem isn't that I can't design it in QT Designer. It is designed >

Re: Replace blanks with letter

2013-08-22 Thread Dave Angel
eschneide...@comcast.net wrote: > I wanted the program to stop only after all the letters were typed; why in > the world would I try to write a program with blanks for each letter that > seem intended to be filled, only to have it stop if the last letter is typed, > or have to type each letter

Re: Replace blanks with letter

2013-08-21 Thread Dave Angel
eschneide...@comcast.net wrote: > Thanks. I am running into a bunch of problems with the following code, all of > which are clear when running the program > > import random > letters='abcdefg' > blanks='_'*len(letters) > print('type letters from a to g') > print(blanks) > for i in range(len(let

Re: Replace blanks with letter

2013-08-20 Thread Dave Angel
eschneide...@comcast.net wrote: > Is there also a way to have the code remember what I typed and not stop after > the first letter the user types? For example, if I typed 'a' once, thus > returning 'a__', and then typed in 'b', I want the code to return > 'ab_' and so on. I wasn't clear

Re: opposite of __init__.py

2013-08-19 Thread Dave Angel
Tamer Higazi wrote: > Hi people! > > I have asked myself a question, if there is a opposite of "__init__.py" > like "__del__.py" ?! Others have answered your question, but I wanted to correct a misunderstanding: > > I want, that when the application ends, certain functions are executed. > I know

Re: Importing variables non-deterministic?

2013-08-19 Thread Dave Angel
Antoon Pardon wrote: > Op 19-08-13 11:18, Chris Angelico schreef: >> The issue >> was regarding imports, and it's perfectly safe to import a constant, >> even if the interpreter doesn't protect you from then being a total >> idiot and changing it. > > Python doesn't have constants, so you sta

Re: refresing the edited python function

2013-08-19 Thread Dave Angel
Sudheer Joseph wrote: > Thank you Dieter, > I never thought it will be so difficult task, All I was > thinking was that, I just do not know how it is done. I wonder how the code > developers work in this case every time a function is modified one has to > restart the consol

Re: Importing variables non-deterministic?

2013-08-19 Thread Dave Angel
Antoon Pardon wrote: > Op 17-08-13 17:01, Steven D'Aprano schreef: >> >> And here you re-import the name "y" from struct_global. That rebinds the >> current module's "y" with whatever value struct_global.y has *now*, >> rather than a second (or a minute, or an hour) earlier when the first >> i

Re: Local variable in a closure

2013-08-18 Thread Dave Angel
w.w.mil...@googlemail.com wrote: > Is f local or not? > http://pastebin.com/AKDJrbDs Please have a little respect, and include the source in your message. You managed quite nicely to keep it small, but you put it in an obscure place that some people won't be able to reach, and that might not sur

Re: .split() Qeustion

2013-08-15 Thread Dave Angel
Roy Smith wrote: > In article <520da6d1$0$3$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> On Thu, 15 Aug 2013 16:43:41 +0100, Chris Angelico wrote: >> >> > A mole is as much a number (6e23) as the light year is a number >> > (9.5e15). >> >> Not quite. A mole (abbreviat

Re: .split() Qeustion

2013-08-15 Thread Dave Angel
Terry Reedy wrote: > On 8/15/2013 2:28 PM, Chris Angelico wrote: >> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau wrote: >>> On 15 August 2013 16:43, Chris Angelico wrote: A mole is as much a number (6e23) as the light year is a number (9.5e15). >>> >>> A mole is a number. A light year is

Re: Verifying Variable value

2013-08-14 Thread Dave Angel
chandan kumar wrote: > Hi , > > Is there a way to validate variable values while debugging any python > code.Run below example  in debugging mode and i would like to know the value > of c (I know print is an option) with any other option other than printing. > In C# or some other tools we can v

Re: .split() Qeustion

2013-08-13 Thread Dave Angel
eschneide...@comcast.net wrote: > How can I use the '.split()' method (am I right in calling it a method?) > without instead of writing each comma between words in the pie list in the > following code? Also, is there a way to use .split instead of typing the > apostrophes? Thank you. > > import

Re: Getting a value that follows string.find()

2013-08-13 Thread Dave Angel
englishkevin...@gmail.com wrote: > I know the title doesn't make much sense, but I didnt know how to explain my > problem. > > Anywho, I've opened a page's source in URLLIB > starturlsource = starturlopen.read() > string.find(starturlsource, '>> import string >>> help(string.find) Traceback (most

Re: Am I not seeing the Error?

2013-08-13 Thread Dave Angel
Denis McMahon wrote: > On Sat, 10 Aug 2013 22:19:23 -0400, Devyn Collier Johnson wrote: > >> I am checking my 1292-line script for syntax errors. I ran the following >> commands in a terminal to check for errors, but I do not see the error. > >> JOB_WRITEURGFILES = >> multiprocessing.Process(write

Re: Question about function failing with large number

2013-08-13 Thread Dave Angel
Anthony Papillion wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > So I'm using the function below to test a large (617 digit) number for > primality. For some reason, when I execute the code, I get an error > telling me: > > OverflowError: long int too large to convert to float In

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > how can i solve this problem I simplified the code so I could actually run it, and tested it in Python 2.7, both under Komodo IDE and in the terminal. The code: #!/usr/bin/en

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > I simplified your code so anybody could run it, and tested it inside Komodo IDE, on Python 2.7 #!/usr/bin/env python import sys import os import time import threading class MyC

Re: Calling Python macro from ctypes

2013-08-12 Thread Dave Angel
Peter Otten wrote: > Steven D'Aprano wrote: > >> Is it possible to call a Python macro from ctypes? For example, Python >> 3.3 introduces some new macros for querying the internal representation >> of strings: >> >> http://www.python.org/dev/peps/pep-0393/#new-api >> >> >> So I try this in 3.3:

Re: back with more issues

2013-08-12 Thread Dave Angel
Kris Mesenbrink wrote: > darn i was hoping i could put off learning classes for a bit, but it seems > that is not the case. i have tested it a bit and it seems to be working > correctly now. > > > import random > > class player(): > hp = 10 > speed = 5 >

Re: back with more issues

2013-08-11 Thread Dave Angel
Kris Mesenbrink wrote: > import random > > def player(): > hp = 10 > speed = 5 > attack = random.randint(0,5) > The net resut of this function is nothing. It assigns values, then they're lost when the function returns. A function is the wrong way to deal with these three names. > de

Re: Introduction to my fellow Python Friends

2013-08-11 Thread Dave Angel
Krishnan Shankar wrote: > Hi Friends, Hi, and welcome to the mailing list. > I figured out that the best way is to talk to the experts and so i > subscribed to this mailing list. It will be cool if anybody can help me out > by telling the etiquette of this mailing list, like > > 1. How to

Re: right adjusted strings containing umlauts

2013-08-08 Thread Dave Angel
Kurt Mueller wrote: > Now I have this small example: > -- > #!/usr/bin/env python > # vim: set fileencoding=utf-8 : > > from __future__ import print_function > import sys, shlex > > print( repr( sys.stdin.encoding ) ) > > strg_form = u'{0:>3}

Re: right adjusted strings containing umlauts

2013-08-08 Thread Dave Angel
Kurt Mueller wrote: > Am 08.08.2013 16:43, schrieb jfhar...@gmail.com: >> On Thursday, 8 August 2013 15:23:46 UTC+1, Kurt Mueller wrote: >>> I'd like to print strings right adjusted. >>> print( '>{0:>3}<'.format( 'ä' ) ) >> >> Make both strings unicode >> print( u'>{0:>3}<'.format( u'ä' ) ) >> W

Re: Issues with if and elif statements in 3.3

2013-08-08 Thread Dave Angel
krismesenbr...@gmail.com wrote: > def town(): > print ("You stand in the middle of Coffeington while you descide what" > " to do next, you have herd rumor of the Coffeington Caves that run" > "under the city, would you like to check them out?") > answer = input() > if answer ==

Re: new to While statements

2013-08-07 Thread Dave Angel
Vito De Tullio wrote: > Dan Sommers wrote: > while "asking for reponse": >>> while "adventuring": >>> >>> that's a funny way to say `while True:`... >> >> Funny, perhaps, the first time you see it, but way more informative than >> the other way to the next one who come

Re: beginner question (True False help)

2013-08-07 Thread Dave Angel
eschneide...@comcast.net wrote: > What I wanted to happen is when the user typed something other than 'y' or > 'yes' after being asked 'go again?', the batman==False line would cause the > program to stop asking anything and say 'this is the end'. Instead, what is > happening is that the progra

Re: Beginner question

2013-08-06 Thread Dave Angel
eschneide...@comcast.net wrote: > Why won't the 'goodbye' part of this code work right? it prints 'ok' no > matter what is typed. Much thanks. > > def thing(): > print('go again?') > goagain=input() > if goagain=='y' or 'yes': This expression doesn't do what you think. The compariso

Re: Creating a running tally/ definitely new to this

2013-08-05 Thread Dave Angel
gratedme...@gmail.com wrote: > > I currently working on a game, where I need to maintain a running tally of > money, as the player makes purchases as they navigate thru game. I not > exactly sure how to do this in python. I know it is a fairly basic step, > nonetheless. Any assistance would

Re: Hangman question

2013-08-04 Thread Dave Angel
eschneide...@comcast.net wrote: > I'm on chapter 9 of this guide to python: > http://inventwithpython.com/chapter9.html but I don't quite understand > why line 79 is what it is (blanks = blanks[:i] + secretWord[i] + > blanks[i+1:]). I particularly don't get the [i+1:] part. Any additional

Re: outputting time in microseconds or milliseconds

2013-08-04 Thread Dave Angel
matt.doolittl...@gmail.com wrote: > ok so now i import the module like this: > >from time import strftime, time > > i made the write statement like this: > >self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", >self.logfile.write('%s\t'%(str(strftime("%H:%M:%S", >self.logf

Re: Removing matching items from a list?

2013-08-03 Thread Dave Angel
kevin4f...@gmail.com wrote: > > Would you also happen to know how I could set up a list that keeps track of > the removed sets? > Let's see, i think that makes 5 times you've asked the same question, counting the dups you apparently sent to the same person. Instead of writing all these mes

Re: Crawl Quora

2013-08-03 Thread Dave Angel
Umesh Sharma wrote: > Hello, > > I am writing a crawler in python, which crawl quora. I can't read the content > of quora without login. But google/bing crawls quora. One thing i can do is > use browser automation and login in my account and the go links by link and > crawl content, but this me

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Dave Angel
kevin4f...@gmail.com wrote: > I'm trying to create a game of Go Fish in Python. But I've stumbled onto a > little problem that I can't seem to figure out how to deal with. > Please list the program the way you are actually running it. The present one will not run very long before producing

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Dave Angel
matt.doolittl...@gmail.com wrote: > Hey everybody, > > I am using 2.7 on Ubuntu 12.10. and what version of Python are you using? I don't know if it matters, but it's useful to always supply both Python version and OS version. > All I need to do is to print time with the microseconds. I have b

Re: PEP8 revised: max line lengths

2013-08-01 Thread Dave Angel
Terry Reedy wrote: > On 8/1/2013 7:33 PM, Dave Angel wrote: >> Terry Reedy wrote: >> >> >>>>> >>>>> The diff with all the changes is here >>>>> http://hg.python.org/peps/rev/fb24c80e9afb >>>> >> >> Just ou

Re: Python and PyQt (Windows) - AttributeError: 'module' object has not attribute run

2013-08-01 Thread Dave Angel
alesssia wrote: >> My guess is that somehow when the zip file was extracted, the case of >> this file was not preserved, and it came out pmc.py. > > The zip was not extracted because there was no zip. I copied the code from my > computer to a USB pen drive and ran the code from there. Tha

Re: PEP8 revised: max line lengths

2013-08-01 Thread Dave Angel
Terry Reedy wrote: >>> >>> The diff with all the changes is here >>> http://hg.python.org/peps/rev/fb24c80e9afb >> Just out of curiosity, where is "coding cookie" defined? I found enough distant references to decide it was supposed to mean the coding line (line 2, typically in Unix). But I ori

Re: Does Python 'enable' poke and hope programming?

2013-08-01 Thread Dave Angel
CM wrote: > what now strikes me as a Very Bad Habit, which is "poke and hope" > (trial and error) programming (of several names this page provided, I kind > of like that one): > I recall when a "compile" took up to two days, before we got the punched paper tape to begin testing. If we wante

Re: How do I deal with packet data

2013-08-01 Thread Dave Angel
Pacopag wrote: > Hi. > > I have the hex stream of a packet that a program sent over the network. Now > I want to view the data in the packet. I'm pretty sure the data was just a > string (or at least contains a string), but when I decode it I just get > gibberish. > > For example, the packet

Re: script to Login a website

2013-08-01 Thread Dave Angel
wachk...@gmail.com wrote: > On Wednesday, July 31, 2013 11:33:25 AM UTC-4, wach...@gmail.com wrote: >> I have created a script to log in a website. It gets its username and >> password from two files, then log's in with this credentials. My code is not >> showing me what username it is using to

Re: script to Login a website

2013-08-01 Thread Dave Angel
wachk...@gmail.com wrote: > On Wednesday, July 31, 2013 12:21:59 PM UTC-4, John Gordon wrote: >> >> How is the data in 'users.txt' and 'password.txt' organized? Given the >> >> filenames, I would expect that 'users.txt' contains one username on each >> >> line, and 'password.txt' contai

Re: Python and PyQt (Windows) - AttributeError: 'module' object has not attribute run

2013-08-01 Thread Dave Angel
alesssia wrote: > I developed a python3-PyQt4 application (I’m a newbie!) on a 32-bit Linux > platform, and I’m experiencing some problems when testing it on Windows > platforms (Windows 7 and 8, both 64-bit). > > I have a module called Pmc.py that contains two methods: run and main, but > only

Re: importing modules

2013-07-30 Thread Dave Angel
On 07/29/2013 05:57 PM, syed khalid wrote: I am attempting to import modules from Shogun to python from a non-standard python directory ie from my /home/xxx directory. is there a way on ubuntu to selectively some modules, scripts, data from one directory and others modules, scripts from another

Re: import syntax

2013-07-29 Thread Dave Angel
On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Pep 8 is not about performance, it's about readability. And unless the two l

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 12:32 PM, Alister wrote: On Sat, 27 Jul 2013 08:56:10 -0400, Devyn Collier Johnson wrote: Good point about the Made by/Copyright suggestion. Although, I have not copyrighted the file, can I still say "Copyrighted by ...".-- There is no special process to Copyright anything. the

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 08:56 AM, Devyn Collier Johnson wrote: Somehow during this thread, you have changed your purpose for this library. It used to be a library that Python programmers could import and use. And now, it's a shell replacement? The user runs the Python interpreter, and types

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 09:19 AM, Devyn Collier Johnson wrote: About the aliases, I have tried setting pwd() as an alias for "os.getcwd()", but I cannot type "pwd()" and get the desired output. Instead, I must type "pwd". I tested this in Guake running Python3.3. >>> os.getcwd() '/home/collier'

Re: Creating a Simple User Interface for a Function

2013-07-25 Thread Dave Angel
On 07/25/2013 04:58 PM, CTSB01 wrote: Sorry Dave, to answer each part of your response: 1) I decided to use Python 2.7, and I will be sure to specify this in all future threads. 2) It is a list of positive integers. In fact, it is always going to be a list of positive increasing

<    4   5   6   7   8   9   10   11   12   13   >