-
Edited Algorithmic challenge
Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a … -
Edited Algorithmic challenge
Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a … -
Created Algorithmic challenge
Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a … -
Replied To a Post in Weird Plotting Behaviour
Yes , you mistakenly believe that the function equals 1. The square root is in fact `sqrt((x-1)**2)` Mathematically, it has the same value as `abs(x-1)`, which is `x-1` when `x … -
Gave Reputation to ddanbe in Weird Plotting Behaviour
Your function evaluates to 1 for x >= 1 and to < 1 for x < 1. So the behaviour is completely normal. Try out and make a table of … -
Replied To a Post in Pygal chart
What is the question ? -
Replied To a Post in List comprehension in python
Well, here is the same loop with more prints to show what's happening result = [] for c in ['as', 'df']: print 'c =', repr(c) for i in range(len(c)): print … -
Replied To a Post in List comprehension in python
It is the same difference as between result = [] for c in ['as', 'df']: for i in range(len(c)): result.append(c[i]) print result and result = [] for c in ['as', … -
Gave Reputation to happygeek in How to check for and securely remove Superfish badware from your Lenovo PC
Chinese computer manufacturer [Lenovo has admitted](http://support.lenovo.com/us/en/product_security/superfish) that it installed an adware component called Superfish on 16 million PCs shipped between September 2014 and February 2015 in order to "help customers … -
Gave Reputation to happygeek in How to check for and securely remove Superfish badware from your Lenovo PC
Chinese computer manufacturer [Lenovo has admitted](http://support.lenovo.com/us/en/product_security/superfish) that it installed an adware component called Superfish on 16 million PCs shipped between September 2014 and February 2015 in order to "help customers … -
Replied To a Post in Adidas.com program. Assistance with Python
Hm, the RAR file contains two exe programs which are fired by the python program. It is probably a virus or spyware. The best thing to do is **not to … -
Replied To a Post in Smtp and datetime error
The problem is that there is a file `calendar.py` on the python path which shadows the builtin module calendar. The traceback says "C:/Users/palmer_a/Documents/App\calendar.py" but it should be "C:\Python34\lib\calendar.py" The solution … -
Replied To a Post in How to take numbers out from a list to get number 244
This is very similar to your previous question. Take the time to understand how the code works number = int(''.join(mylist)) -
Replied To a Post in Get a Python module's location
Also have much more details from the command line with this snippet https://www.daniweb.com/software-development/python/code/478935/launch-default-editor-for-python-module- -
Replied To a Post in Import from ???
Well, you can use the index of the python documentation https://docs.python.org/3/genindex-all.html It could be your beginner's project: write a command line tool which tells you from which module you can … -
Replied To a Post in "Hello World" Fun
A small improvement ! import time import random import sys if sys.version[0]=='3': from tkinter import * else: from Tkinter import * root=Tk() root.title('hello world in German') canvas = Canvas(root,width=400, height=400, … -
Replied To a Post in problem with deleting a list indexes with both int and str
To empty the list, use numbers[:] = [] -
Replied To a Post in taking numbers and operators out from the list to run the operation
You are trying to evaluate an arithmetic expression. There are several levels of understanding of your question. 1) If you only want a working solution, you can use python's own … -
Replied To a Post in Python Start Script Problem
You need a space between the two words `if` and `__name__`. -
Gave Reputation to TrustyTony in Is my program better with "do while" or "for with if" conditional loop
Here is example of minimum function with iterable and function to calculate distance: from math import hypot from functools import partial def distance(p1, p2): return hypot(p2[1] - p1[1], p2[0] - … -
Replied To a Post in "Hello World" Fun
@fonzali is this what you mean ? [Click Here](https://www.youtube.com/watch?v=qChbkdiGeRA). Unfortunately, the code is unavailable ;). Let's rewrite it ! -
Replied To a Post in "Hello World" Fun
This one looks better with python 3 import cgitb, os, sys, tempfile, webbrowser dst = os.path.join(tempfile.gettempdir(), 'helloworld.html') try: raise type('Hello World', (Exception,),{}) except: with open(dst, 'w') as ofh: ofh.write(cgitb.html(sys.exc_info())) webbrowser.open(dst) -
Replied To a Post in "Hello World" Fun
@pytony it says HELLO OWLR, there must be something wrong. -
Replied To a Post in runpy how to get a module object before the module's code is executed??
Hey Tcll, here is a small experiment which may explain what happens >>> import sys >>> import anytree >>> anytree.__name__ 'anytree' >>> anytree.__name__ = 'foobarbazqux' >>> reload(anytree) Traceback (most recent … -
Replied To a Post in What does epsilon in python mean?
epsilon has no special meaning in python. It is a valid identifier which can be used as a variable name as in the above code. In numerical analysis, epsilon is … -
Replied To a Post in closing internet browser
Here is an example session in my terminal 15:26 atelier] ps aux | grep firefox eric 2547 1.6 7.5 1484500 305384 ? Sl 12:44 4:40 /usr/lib/firefox/firefox --sm-config-prefix /firefox-iWhUk7/ --sm-client-id 1017a158179130000142325992000000022580029 … -
Replied To a Post in How to open and play mp3 file in python?
In linux, you can use `subprocess.call(['xdg-open','NAMEOFFILE'])`. -
Replied To a Post in Islamic State down: Anonymous drops social media bomb on ISIS
These anonymous could very well be a western intelligence agency. -
Replied To a Post in Member of the Month: nominations please
No, not me thanks, I don't want to be famous, I prefer anonymity. Why not Woooee or Snippsat ? -
Replied To a Post in Error about float and insert
Then can you post the whole new code in this thread ? Use the `Code` button in the editor to paste your code in a popup window. Also can you … -
Replied To a Post in Error about float and insert
You probably mean `Total.insert()` instead of `total.insert()`. Edit: Note that your `global` statements are unnecessary. `global x` is only necessary in a function if the function contains a line `x … -
Gave Reputation to HiHe in Projects for the Beginner
Explain the output of this code: # generator expression g = lambda: ((yield x) for x in range(5)) z = g() for k in range(5): print(next(z)) -
Replied To a Post in Inserting values to sqlite table using input
There is a `+=` in HiHe's code. Do you understand it ? -
Gave Reputation to HiHe in Inserting values to sqlite table using input
This might help: ''' tk_sqlite3_label.py create a sqlite3 database and load it read the database and put the resulting string into a Tkinter label ''' import tkinter as tk import … -
Gave Reputation to HiHe in Inserting values to sqlite table using input
This might help: ''' tk_sqlite3_label.py create a sqlite3 database and load it read the database and put the resulting string into a Tkinter label ''' import tkinter as tk import … -
Replied To a Post in Inserting values to sqlite table using input
Perhaps `label.config(text='value')` -
Replied To a Post in Inserting values to sqlite table using input
I think `execute()` expects a tuple such as `(word,)` instead of `(word)` which is the same as `word` without parentheses. -
Replied To a Post in Inserting values to sqlite table using input
Open the documentation page of the [sqlite3 module](https://docs.python.org/2/library/sqlite3.html#module-sqlite3), then search all occurrences of `INSERT INTO` in this page. Your answer is there! -
Replied To a Post in count occurrences in two dictionaries
Ok, you can change your code like this def get_item1(line): return ((line[0], line[1]), line[2]) def get_key2(line): return (line[3], line[4]) k1 = dict(get_item1(line) for line in list1) count2 = Counter(k for … -
Replied To a Post in count occurrences in two dictionaries
> I need to add to the final "result" the third value of list1 where the two lists match. You must describe this more precisely. From what I understand you … -
Marked Solved Status for Downloading thread code.
The following program is able to download the python programs contained in a thread of the python forum. Just start the program, it will prompt you for the thread number … -
Marked Solved Status for Guido van Rossum talks about his language.
I thought users of the python forum could be interested in a seminar conference by Guido van Rossum about the design and implementation of the python language, so here is … -
Replied To a Post in PyDark 2D Game Framework
Thank you for sharing! -
Gave Reputation to Froweey in PyDark 2D Game Framework
Greetings: I've noticed that many people on these boards have experience using PyGame, so I thought it would be cool if i shared a creation I am currently developing. This … -
Replied To a Post in Shoes!!!!
If you only want simple things such as buttons, entries, choices etc, I discovered [guidata](https://pythonhosted.org/guidata/examples.html#basic-example) recently which is extremely easy to use. It is based on Qt in python but … -
Replied To a Post in Shoes!!!!
Yes it looks like an experimental module by a [famous ruby guru](http://www.smashingmagazine.com/2010/05/15/why-a-tale-of-a-post-modern-genius/). Is it still developped ? -
Replied To a Post in count occurrences in two dictionaries
Assuming that you already have lists of "lines" which are tuples or lists, I suggest something along the line of from collections import Counter get_key(line): return (line[3], line[4]) # compute … -
Replied To a Post in count occurrences in two dictionaries
I don't understand, please post code with complete dictionaries and describe your expected output. -
Replied To a Post in count occurrences in two dictionaries
What are your dictionaries? Python's built-in dictionaries cannot have several occurrences of the same key. -
Replied To a Post in getting a line position
It is true, although I've read rumors that `file.tell()` is slow, at least in text mode. See [Click Here](http://bugs.python.org/issue11114) for example. You can also define your own wrapper def traverse_file(ifh): …
The End.