• Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Converting C++ Code to Python

    @Praveen_20 Please start your own thread and show the attempts you made to translate this to python. We may then help you.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How To Create Infinite Classes

    > The only problem I'm encountering is that I cannot create enough names for all of this by hard-coding it I'm not sure I understand this question very well. It …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how

    Because of operator precedence, the first if is equivalent to if ((matirial == 'maths') or ('math') or ('Maths') or ('Math') or ('رياضيات')): The result of the or .. or .. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in if and elif and else

    It is because after `age = raw_input('...')`, age is a character string. It needs to be converted to an integer like this age = raw_input ('enter you age-->') age = …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Array - columns

    I recommend using the built-in csv module to read csv files. You can simply use import csv with open('eggs.csv', newline='') as csvfile: spamreader = csv.reader(csvfile, delimiter=',') data = [row[3:] for …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in IndexError: list index out of range

    If there is no `lines[-1]` it means that the `lines` list is empty (there is no last item). Try to check the length of the list first.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in IndexError: list index out of range

    Normally, the exception traceback that python prints on the screen tells you the line number and statement where the error occurred. Can you post the whole traceback ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Logical "OR":

    @Madhu_6 It is permitted, but it does not have the meaning you expect. Here is an experiment >>> small_case = "abcdefghijklmnopqrstuvwxyz" >>> space = " " >>> camel_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in KeyError with Python dictionary

    I get Traceback (most recent call last): File "spec.py", line 24, in test_remove_item self.assertEqual(self.cart.items['Mango'], 1, msg='Quantity of items not correct after removing item') KeyError: 'Mango' If you look at the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in KeyError with Python dictionary

    This code does not throw a KeyError, it only defines two classes and does nothing.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Tkinter Digital Clock (Python)

    @James_77 I would try to use the timezone data available in the `dateutil` module, for example >>> import dateutil.tz >>> from datetime import datetime >>> spain = dateutil.tz.gettz(name='CET') >>> d …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart Python program does not work

    > But still, when I use this function in my main program, it just won't work Add temporarily a `raise` statement in your main program except: raise ... it will …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart Python program does not work

    The exception is a NameError. The solution is to add import os import sys at the top of the program. Then it works. Notice that a bare except: ... is …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart Python program does not work

    Can you add enough code so that we can have the button that calls the `resize()` function and try it ourselves and reproduce the error ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in I need to make this python code to only take one parameter

    I don't understand the statement that this python code takes multiple parameters nor how it could take only one parameter. Can you elaborate on this so that everybody understands what …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited I need to make this python code to only take one parameter

    I need to make this python code to only take one parameter. Right now it takes multiple. def get_list(): return [input("Please enter a string: ") for i in range(int(input("Please enter …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in New moderator alert!

    Thanks for your efforts AssertNull. It enlightens the debate.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help with a simple python Area Calculator???

    @prince_16 Many python snippets written 7 years ago were written in python 2. That's why they don't work out of the box in python 3. However they can be easily …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in New moderator alert!

    I think I must be missing something in Diafol's post because of language barrier, something that Happygeek caught. Can someone explain ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in New moderator alert!

    Welcome aboard rproffitt!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    > But still, when I start the program via CMD and trigger the piece of code to restart the script, the window shuts down and does not come back again …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    @S._1 Can you start you own thread and post your code ? We could probably diagnose why your GUI doesn't show.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    Wow, with the editor toolbar in fullscreen mode, this mode is usable in qutebrowser! The whole process of sending a post can be done with keyboard only! Awesome.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    You're right. It may be the tag system that gives the impression that the site is a tote. There used to be a section for each language for example, now …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    A tiny difference that I like for example is this: if I watch the thread [Need Help With Hangman](http://www.programmingforums.org/thread48563.html) , there is a clickable bar at the top that says …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    It is difficult for me to analyse it, but I feel better with a traditional design such as [programmingforum's](http://www.programmingforums.org/) for example. I'm trying to understand where is the difference. Basically …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in secure proxy objects for frontend API

    It looks interesting, a tutorial is missing however.
  • Member Avatar for Gribouillis
    Gribouillis

    Edited secure proxy objects for frontend API

    **Usage:** Provides a secure frontend object with restricted access to attributes of the backend object.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    When I joined Daniweb, there was a very active and friendly group of helpers in the python forum, led by Vegaseat, and most threads were from beginners learning python programming …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to Dani in Fullscreen editor

    DaniWeb's editor now has a fullscreen mode. Click the icon in the editor toolbar (or press F11) to enter fullscreen mode. ESC and F11 will both exit fullscreen.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Fullscreen editor

    Hm, I'm having an issue with the fullscreen mode in the awesome [qutebrowser](http://www.qutebrowser.org) browser: the F11 key is already bound to toggle the browser's fullscreen mode, and the Esc key …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Saying raw_input() Isn't Matching A Variable

    Here is an experiment in the python console >>> s = raw_input('Please Enter Password: ') Please Enter Password: Nether >>> s 'Nether' You see that the string has been stripped …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python: Reading large excel files in write only mode

    I don't think it is possible. Using `pydoc openpyxl.load_workbook` shows a `read_only` option but no `write_only` option. It seems to exist only for new workbooks. I think using large excel …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in what's the best form of rotation data structures?

    At the end of the wiki page on [rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix), there is a link to the [Rodrigues rotation formula](https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula). This could be what you're looking for.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in distance speed time with a float or an integer

    The trick is often to convert the number to a float >>> ispeed = 1 # <--- integer speed >>> fspeed = 0.5 # <--- float speed >>> sspeed = …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Understanding where the Error is.

    The `except` keyword can occur only in a `try` statement, and must have the same indention as the preceding `try`. try: statement statement statement except ValueError: statement statement Also, this …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python_Query

    The import statement is the mechanism that allows python programs to use libraries. Using libraries is a key feature in any programming language. It allows our programs to benefit from …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in import 13 row from .csv file into list

    Here is how you can fetch 13 rows from the csv file (python 3 code) import csv import itertools as itt with open('file1.csv', 'rt') as f: reader = csv.reader(f) rows …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to JamesCherrill in improving time complexity

    Unlike the other solutions this is guaranteed time complexity On, (additional) memory zero. int count = a.length; for (int i = 0; i < a.length; i++) { if (a[i] == …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in import 13 row from .csv file into list

    This small [tutorial](https://pymotw.com/3/csv/) will teach you how to read and write csv files with python. You can post your code here if there are issues.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in New search functionality

    Much better!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Horner polynomial evaluation

    There is also an implementation at [Rosetta code](https://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation#C.23). It is very short, but I haven't used C# for a long time, so I don't know if it is good.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Third party modules in Python

    > And what should I do when I get the following message when I want to install a module Third party modules don't need to be referenced in the python …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Third party modules in Python

    Of course it is possible, third party modules need to be installed with a tool such as pip, then they can be imported. For example if we want to use …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Converting C++ Code to Python

    @Robiul for i in range(10): for j in range(i, 10): do_something() Happy coding.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I write 2 numbers?

    Usually you don't do it, you read and parse the input file by various means, for example >>> import io >>> stdin = io.StringIO("""34 78""") >>> line = stdin.readline() >>> …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in can't import module

    I'd recommend using `python setup.py develop` first, which will install a symbolic link allowing python to import and use myapp without really installing the package. If you're using a virtualenv, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in SpaceVim - Like spacemacs, but for vim

    Anyway, I won't use vim nor spacevim as long as they don't have a serious support for the bépo keyboard.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in arguments with non latin character

    @Dave_15 I don't quite agree with you. First your post contains no *obvious solution* for this specific issue. Second I don't have a political agenda telling me to get more …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Script to do some commands in linux server

    It looks more like a windows question than a linux question. I think the [plink.exe ](http://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter7.html) tool can execute remote commands through ssh.

The End.