Re: [Tutor] Q about .join() Thanks!

2017-02-14 Thread Joaquin Alzola
>I find out that the outcome for using .join() on a dictionary is totally >different than it using on list or string. for example, > >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} > >>> > boy:good:doiido:hello >So my question is why the outco

Re: [Tutor] Q about .join() Thanks!

2017-02-14 Thread Peter Otten
Danny Yoo wrote: > Moreover, most implementations *deliberately* randomize their iteration > order to avoid a particular kind of hash collision attack out there in > the wild. See: In CPython the hash() of a string may change between different runs to fend off hash collision attacks, but that

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread Danny Yoo
> That's because dictionaries are not stored sequentially and the > order of retrieval is not guaranteed - it can even change > during the execution of a program so you should never > depend on it. That's because dictionaries are optimised > for random access via the keys not to be iterated over.

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 18:34, SIJIA CHEN wrote: > I find out that the outcome for using .join() on a dictionary is > totally different than it using on list or string. Not really, it just looks like that :-) > > >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} > >>> p

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread David Rock
> On Feb 13, 2017, at 12:34, SIJIA CHEN wrote: > > I find out that the outcome for using .join() on a dictionary is totally > different than it using on list or string. for example, > seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} print ':'.join(seq4) > boy:good:doii

Re: [Tutor] Q regarding external program calling

2016-11-07 Thread eryk sun
On Sun, Nov 6, 2016 at 9:09 AM, Alan Gauld via Tutor wrote: > On 06/11/16 01:44, Clayton Kirkwood wrote: >> Looked all over, but haven't found the answer. If I have a (windows) program >> which I wish to start, even shell scripts, and possibly capture the output >> from, how do I do that? > > Othe

Re: [Tutor] Q regarding external program calling

2016-11-06 Thread Alan Gauld via Tutor
On 06/11/16 01:44, Clayton Kirkwood wrote: > Looked all over, but haven't found the answer. If I have a (windows) program > which I wish to start, even shell scripts, and possibly capture the output > from, how do I do that? Others have already pointed you to the subprocess module. The documentat

Re: [Tutor] Q regarding external program calling

2016-11-05 Thread Danny Yoo
Hi Clayton, I'm not too familiar with development on Windows, unfortunately, but I think the 'subprocess' module is what you're looking for. https://docs.python.org/3/library/subprocess.html For example: http://stackoverflow.com/questions/748028/how-to-get-output-of-exe-in-python-script sh

Re: [Tutor] Q

2011-06-08 Thread Brett Ritter
On Wed, Jun 8, 2011 at 3:25 PM, Vincent Balmori wrote: > In the "Loop of Game" section of my code for some reason it gives me five > more chances than I wanted it to. When I put two as the chance limit, it > allowed seven. Also, the program will always say "yes" to any letter I > enter, even if it

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Kent Johnson
Toon Pieton wrote: > Hey Kent, > > Thanks for your reply. Can you suggest which module I should look at? > And can I make diagrams using that module? Assuming you are asking about modules for writing CSV files, then look at the csv module. CSV (comma-separated value) is a simple text format th

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Tim Golden
[Kent Johnson] | Tim Golden wrote: | > Using win32com and Excel is very easy, but there | > are alternatives if you want: | > | > http://cheeseshop.python.org/pypi/xlrd/0.5.2 | | xlrd is for reading only - OP wants to write Excel files. Oops! Quite right. I was moving a bit too fast. Sorry, OP

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Kent Johnson
Tim Golden wrote: > Using win32com and Excel is very easy, but there > are alternatives if you want: > > http://cheeseshop.python.org/pypi/xlrd/0.5.2 xlrd is for reading only - OP wants to write Excel files. Kent ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Kent Johnson
Toon Pieton wrote: > Hey, friendly person who took the time to read this! > > I'm cutting right to the case. Trying to get certain information into > Excel. However, I can't: > > from win32com.client import Dispatch > > xlApp = Dispatch(" > Excel.Application") > # continues > > As soon as I st

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Tim Golden
[Toon Pieton] | As soon as I start the program, I get a error: | win32com.client not found. This - of course - leads to the | conclusion that I don't have the win32com module installed. I | tried to find it (Google), but all I could find when | searching for "python win32 module (download)", I

Re: [Tutor] Q

2006-09-05 Thread Alan Gauld
> my Q is how do you learn the languge of python ? > and how do you program? Visit the Python website, download and install Python for your platform. Visit the beginners page and find a beginners tutorial that you like (maybe mine). http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

Re: [Tutor] Q

2006-09-05 Thread tomd
> my Q is how do you learn the languge of python ? and how do you program? see http://www.freenetpages.co.uk/hp/alan.gauld/ -- Tom, http://www.vscripts.net/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Q

2006-09-05 Thread Kent Johnson
mike park wrote: > my Q is how do you learn the languge of python ? and how do you program? Read one of the tutorials here: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Try things out. Experiment. Ask questions on this list when you get stuck or don't understand something. The book

Re: [Tutor] Q on path information

2006-05-25 Thread Alan Gauld
> And "whereis python" returns > python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 > /usr/include/python /usr/include/python2.4 > /usr/share/man/man1/python.1.gz > > Does this mean I am using the python executable in > "/usr/bin/python/" but it then looks for built-in modules in > "