11 Solved Topics

Remove Filter
Member Avatar for Gribouillis

This is the message I get while trying to answer in a thread. Only, there is no clue of what I could do to prove that I'm actually a human, so that the robot would be satisfied. Can you help me ? (qupzilla/linux) edit: with firefox, it works. Only it's …

Member Avatar for Gribouillis
0
631
Member Avatar for Gribouillis

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 working algorithm that avoids transforming the first string into a list of characters. My first idea is to choose a …

Member Avatar for Gribouillis
0
334
Member Avatar for Gribouillis

My old hard drive with Linux Mint 15 Olivia refused to boot yesterday: kernel panic etc. I tried to repair the file system and now some shared libraries are missing. On this computer, I have a brand new second hard drive with Kubuntu 13.10 freshly installed. From this OS, I can …

Member Avatar for Gribouillis
0
345
Member Avatar for Gribouillis

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 the link [url]http://irbseminars.intel-research.net/GuidoVanRossum.wmv[/url] (it may be easier to download the file first instead of reading it directly from your browser)

1
115
Member Avatar for Gribouillis

How would you safely round a floating point number to the nearest integer ? Python has the built in function [icode]round[/icode], but it returns a floating point number [code=python] >>> round(4.9) 5.0 >>> help(round) Help on built-in function round in module __builtin__: round(...) round(number[, ndigits]) -> floating point number Round …

Member Avatar for Gribouillis
0
3K
Member Avatar for Gribouillis

Suppose that I have a program named myprog, and I type this in a shell [code] $ myprog -z hello -m "this is a message" [/code] The function main in myprog will receive a char** argv containing the following strings [code] "-z", "hello", "-m", "this is a message" [/code] So …

Member Avatar for Gribouillis
0
219
Member Avatar for Gribouillis

Consider the following script [code=python] #!/usr/bin/env python # foo.py import sys print sys.argv [/code] When I run this in a terminal with arguments, here is the output [code] $ ./foo.py -h hello -m "this is a string" ['./foo.py', '-h', 'hello', '-m', 'this is a string'] [/code] My question is: is …

Member Avatar for Gribouillis
0
168
Member Avatar for Gribouillis

What do you think would be the best way to write this structure [code=python] if testA: actionA() if testB: actionB() if textC: actionC() else: actionDefault() else: actionDefault() else: actionDefault() [/code] if I want to write only one call to actionDefault() ?

Member Avatar for Gribouillis
0
139
Member Avatar for Gribouillis

In python, a "function object", that is to say an object which can be called as a function, is simply an instance of a class which has a [icode]__call__[/icode] method. An example is [code=python] class FuncObj(object): def __call__(self, *args): print("args were %s." % str(args)) func = FuncObj() func(1,2,3) # output …

Member Avatar for Gribouillis
0
184
Member Avatar for Gribouillis

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 and create a directory with the code extracted from the thread. I used it to download all the wx examples. …

0
112
Member Avatar for Gribouillis

In the Perl language, you can fork a child process with the following syntax [code=perl] open CHILD, " | programA | programB | program C"; print CHILD "this is an example input"; [/code] (at least, you can do this under linux). This statement starts 3 processes in fact; programA, B …

Member Avatar for slate
0
229

The End.