• Member Avatar for Gribouillis
    Gribouillis

    Marked Solved Status for get timezone from time.struct_time() ?

    Hello, I am writing a little script that needs to get the timezone from an rss feed, and I am using [URL="http://www.feedparser.org/"]Feed Parser[/URL] to parse the rss feeds. The way …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in get timezone from time.struct_time() ?

    > According to > mktime takes struct_time in local time as per > "Use the following functions to convert between time representations:" section of the page As Opsive wrote 10 …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in getting values from file records

    Again we don't know precisely the information that you need. Apparently, your numbers are ordered (but the last number), so I suppose that you treat the first 5 numbers as …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in problem with loops

    > I want to output something is like: v0 v1 v2 v3 v4 Simply don't print the whole dict every time an item is inserted, so for example D = …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How do I enter a function to be calculated

    I suggest to read expressions and use lambda to create a python function deriv = input("Y' = ") # enter for example 2 * x func = eval("lambda x: " …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How do i pair these up with a hint

    Apparently it comes from tutors at python.org 7 years ago. Read [this mail](https://mail.python.org/pipermail/tutor/2007-April/053825.html).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in getting values from file records

    > So I don't understand what you did. Your initial question is ambiguous. You're describing what you want to do, instead of describing the information you need. It would be …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in problem with loops

    To make it short, I think you are doing this with dict `channels` D = {} for i in range(5): D[i] = "v%d" % i for D_key in D: print …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in getting values from file records

    Yes, you must learn to manipulate python's container data types: lists, sets, dicts. You can do many things with your data a = ['06', '15', '26', '34', '36', '-', '16'] …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to mike_2000_17 in Kmail and Kontact recovery

    Did you try to see what you could do with the instructions on [Migrating your KMail/Kontact setup to a new distro](http://userbase.kde.org/Kontact#Migrating_your_setup_to_a_new_distro)? I think that just copying all those config files/folders …
  • Member Avatar for Gribouillis
    Gribouillis

    Marked Solved Status for Kmail and Kontact recovery

    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. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Kmail and Kontact recovery

    Happy end: mike_2000_17's suggestion worked partially. It seemed that kmail recovered some account information but it only showed when I tried to add imap accounts. Then kontact opened pre-filled forms …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in getting values from file records

    Do you know what a python list is ? Read [this example](http://interactivepython.org/courselib/static/thinkcspy/Files/files.html#working-with-data-files) about reading a data file line by line and manipulate its content.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in getting values from file records

    A hint: >>> line = '14 18 35 47 54 - 57\n' >>> line.split() ['14', '18', '35', '47', '54', '-', '57']
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python programme settimeout

    > will exit your program after 5 seconds This fails, but using `os._exit(0)` works, instead of `sys.exit(0)`. In my linux system, the following also works, which is very nice import …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to Greg_4 in Converting celsius to fahrenheit using a loop to display the table

    try this and let me know if it works for you. start = 0 end = 21 increment = 1 def main(): #create table headers print('The following table shows conversion …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python: Connect to remote windows PC command prompt

    Also have a look at the high level module [Fabric](https://pypi.python.org/pypi/Fabric) (although it is probably much easier to set up in a linux box) It also uses ssh and paramiko, so …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python: Connect to remote windows PC command prompt

    Install an ssh server in the remote host and use module paramiko. [This post](http://www.daniweb.com/software-development/python/threads/375262/running-a-file-on-a-remote-computer-using-python#post1615004) is a little old, but it could help.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in store image in blob type of mysql

    I would try sql = 'SELECT `blob_field` FROM `Tab1`' cursor.execute(sql) for row in cursor: blob_value = row[0]
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Any help with Leading Zero's

    Here is the complete code from tkinter import* import sys, random, tkinter ticket_price = 2 i=0 total = 0 def calculatetotals(): valid = set('12345') ticket_entry = tik.get() if ticket_entry not …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Any help with Leading Zero's

    As I said above, use drawing = ' '.join( [' '.join(zstr(G) for G in g),' -',zstr(f[0])]) and the above function `zstr()`.
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to rrashkin in please help.. import into a list

    get rid of "print(input(..." `name1=input("what is your name: ")`
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Any help with Leading Zero's

    At line 49 (in my version), replace `str()` with `zstr()` and define def zstr(ob, width = 2): return '{x:0>{width}s}'.format(x = str(ob), width = width)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Change the First Character of List word to Upper Case

    There is also a solution with the re module import re def cap(match): return match.group(0).capitalize() with open('c:\FLOUpper.txt', 'r') as infile, open('c:\FLOLower.txt', 'w') as outfile: s = infile.read() s = re.sub(r'\b[a-zA-Z]\w*', …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Converting celsius to fahrenheit using a loop to display the table

    You can start by writing pseudo-code to describe the different things that your program must do # print a message saying that the following table # displays temperatures in celsius …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Any help with Leading Zero's

    Here is the code, reindented with tim peter's [reindent](https://pypi.python.org/pypi/Reindent/0.1.0) (not sure it would work without python 2) from tkinter import* import sys, random, tkinter ticket_price = 2 i=0 total = …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to slate in Recursive isPrime function in python

    Yes, it is worse then the infamous: `not re.match(r"^1?$|^(11+?)\1+$", "1" * number_to_test)` birinci: There is nothing wrong with this algo. But computers (more precisely: functions using stack in the operating …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in need help

    This is clearly homework. You must post your python code. Without code, there is no issue to solve.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Tkinter question: button display

    Is this blue enough ? self.btnClear = Button( self.frame, text="Clear Test", relief = FLAT, bg = "blue",highlightbackground="blue", fg="white")
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Kmail and Kontact recovery

    Thanks for your help mike, unfortunately it didn't work. I added some files because the list seems out of date: I have kmail2 files like kmail2rc etc. I think a …
  • Member Avatar for Gribouillis
    Gribouillis

    Created Kmail and Kontact recovery

    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. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in help finding ratio

    The general idea is that there exists a reasonably simple mathematical formula if you can draw *simple* regions in the plane containing only points with a given color.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in help finding ratio

    I dont think there is a *good ratio*. I used this code import numpy as np import matplotlib import matplotlib.pyplot as plt data = """ 37 - 16 - good …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Recursive isPrime function in python

    Probably the worst `isPrime()` function I've ever seen. If num is above 1000000, you are going to stack 1000000 recursive calls ! Python comes with a recursion limit >>> import sys …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Finding alphabetical order of a string

    Here is my best solution word = raw_input("Word to test: ") uword = word.upper() L = sorted((c, pos) for (pos, c) in enumerate(uword)) M = sorted((pos, n) for (n, (c, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Finding alphabetical order of a string

    It looks very much like homework. Start with a program to print the letters of each word in alphabetic order.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in label variables

    > so drawing is a variable and not part of python? Yes, it is a variable name. I'm not sure it is well chosen as english is not my first …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in why can't this function code function properly

    Add `print('Current item is:', repr(item))` between lines 3 and 4.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in label variables

    Hi! Welcome to daniweb and the python forum! You can use a single Label import sys, random, tkinter # sample items without replacement L = list(range(1,60)) random.shuffle(L) g = L[:5] …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to turn accented lowercase character into uppercase

    Yes, but you will write in python 3 in the future if you don't do it yet, so why not write (almost) compatible code right now ? There are good …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to turn accented lowercase character into uppercase

    Use `u'à1'` and `u'é1'` or even better from __future__ import (absolute_import, division, print_function, unicode_literals) Currently, I even use from __future__ import (absolute_import, division, print_function, unicode_literals) from future import standard_library from …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Self Naming Varibles

    Use row = [ ['3'], ['7', '4'], ['2', '4', '6'], ['8', '5', '9', '3'], ]
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Loan approval calculator

    This error occurs when one tries to use a variable before it is defined at the left side of an `=`. The problem in your function `determine_loan_rate()` is that the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in pkg_resources error when i try to run anything

    Run the command `sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist`, then you can use the `locate` command to find your files. Locate creates a database with your filenames.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in pkg_resources error when i try to run anything

    What about pip and cython ? do they work now ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in pkg_resources error when i try to run anything

    Try to open a terminal and type locate Python.h If you don't have the locate command, install it. You may have to update the locate database. See [here](http://osxdaily.com/2011/11/02/enable-and-use-the-locate-command-in-the-mac-os-x-terminal/) for example.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in pkg_resources error when i try to run anything

    I don't use macosx, but don't you miss some python development headers ? For example can you locate the file `Python.h` ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Open CSV file and write new file

    [Dive into python](http://www.diveintopython3.net/) is a well known free book online for beginners. The creator of python, [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum) recently [reviewed](http://neopythonic.blogspot.fr/2013/10/book-review-charles-dierbach.html) and recommended another introductory book in his blog, if …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What is wrong with my code

    I suggest this if module `games.food` contains function `food()`, etc from importlib import import_module import games # games package has all modules to be used. The modules include color, food …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Open CSV file and write new file

    To output the aircheck rows first, etc, one must store the rows as one examines them to determine which group they belong to. One can write searched = ['aircheck', 'linkrunner …

The End.