Search Results

Search found 13693 results on 548 pages for 'python metaprogramming'.

Page 92/548 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • Python tkInter text entry validation

    - by meade
    I'm trying to validate the entry of text using Python/tkInter def validate_text(): return False text = Entry(textframe, validate="focusout", validatecommand=validate_text) where validate_text is the function - I've tried always returning False and always returning True and there's no difference in the outcome..? Is there a set of arguments in the function that I need to include? Edit - changed from NONE to focusout...still not working

    Read the article

  • Proper indentation for Python multiline strings

    - by ensnare
    What is the proper indentation for Python multiline strings within a function? def method: string = """line one line two line three""" or def method: string = """line one line two line three""" or something else? It looks kind of weird to have the string hanging outside the function in the first example. Thanks.

    Read the article

  • python command line yes/no input

    - by h3
    Is there any short way to achieve what APT does in Python ? I mean, when the package manager prompts a yes/no question followed by "[Yes/no]". The scripts accepts YES/Y/yes/y or "enter" (defaults to Yes as hinted by the capital) The only thing I find in the official doc is input/raw_input.. I know it's not that hard to emulate, but it's annoying to rewrite :|

    Read the article

  • Abstract attributes in Python

    - by deamon
    What is the shortest / most elegant way to implement the following Scala code with an abstract attribute in Python? abstract class Controller { val path: String } A subclass of Controller is enforced to define "path" by the Scala compiler. A subclass would look like this: class MyController extends Controller { override val path = "/home" }

    Read the article

  • What's the logical value of "string" in python?

    - by Kamran
    I erroneously wrote this code in python: name = input("what is your name?") if name == "Kamran" or "Samaneh": print("That is a nice name") else: print("You have a boring name ;)") It always prints out "That is a nice name" even when the input is neither "Kamran" nor "Samaneh". Am I correct in saying that it considers "Samaneh" as a true? why? By the way, I already noticed my mistake. The correct form is: if name == "Kamran" or name == "Samaneh":

    Read the article

  • python django automated data addition

    - by zubin71
    I have a script which reads data from a csv file. I need to store the data into a database which has already been created as $ python manage.py syncdb so, that automated data entry is possible in an easier manner, as available in the django shell.

    Read the article

  • Print one word from a string in python

    - by Shai
    Hi, How can i print only certain words from a string in python ? lets say i want to print only the 3rd word (which is a number) and the 10th one while the text length may be different each time mystring = "You have 15 new messages and the size is 32000" thanks.

    Read the article

  • python - remove string from words in an array

    - by tekknolagi
    #!/usr/bin/python #this looks for words in dictionary that begin with 'in' and the suffix is a real word wordlist = [line.strip() for line in open('/usr/share/dict/words')] newlist = [] for word in wordlist: if word.startswith("in"): newlist.append(word) for word in newlist: word = word.split('in') print newlist how would I get the program to remove the string "in" from all the words that it starts with? right now it does not work

    Read the article

  • Splitting a list in python

    - by blob8108
    Hi, I'm writing a parser in Python. I've converted an input string into a list of tokens, such as: ['(', '2', '.', 'x', '.', '(', '3', '-', '1', ')', '+', '4', ')', '/', '3', '.', 'x', '^', '2'] I want to be able to split the list into multiple lists, like the str.split('+') function. But there doesn't seem to be a way to do my_list.split('+'). Any ideas? Thanks!

    Read the article

  • installing opencv for python issues

    - by vlad
    I'm running OS X Leopard. I followed this site to install it. Trying to run any demo script, I now get "No module named opencv.cv", which is obviously stopping me from doing any programming. I am running python 2.5.1 (yes, I know it's kind of old). Why would this be, and how can I solve it? Thanks

    Read the article

  • Customized command line parsing in Python

    - by Moshe
    I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 [email protected] My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my requirements. Any ideas how can this be solved? Any existing library for this?

    Read the article

  • why is there {Raw,Safe,}Configparser in Python 3

    - by Tshepang
    Am surprised there's 3 different forms: RawConfigParser, SafeConfigParser and ConfigParser. I read the differences but why isn't everyone using SafeConfigParser, since it seems, well, safe? I can understand that in the case for Python 2 that the other two were kept for backward compatibility.

    Read the article

  • Run python in a separate process

    - by Bialecki
    I'm looking for a quick bash script or program that will allow me to kick off a python script in a separate process. What's the best way to do this? I know this is incredibly simple, just curious if there's a preferred way to do it.

    Read the article

  • in Python find number of same elements in 2 lists

    - by John
    Hi, In Python if I have 2 lists say: l1 = ['a', 'b', 'c', 'd'] l2 = ['c', 'd', 'e'] is there a way to find out how many elements they have the same. In the case about it would be 2 (c and d) I know I could just do a nested loop but is there not a built in function like in php with the array_intersect function Thanks

    Read the article

  • Sanitising user input using Python

    - by Steve
    What's the best way to sanitise user input for a Python-based web application? Is there a single function to remove HTML characters and any other necessary characters combinations to ensure that an XSS or SQL injection attack isn't possible?

    Read the article

  • Creating a sliding frame containing widgets in tkinter in python

    - by Buki
    I am trying really hard to make a sliding frame containing widgets in tkinter in python. There is this frame inside a big window with different widgets. And as soon as i click on the next button on that frame the frame should slowly slide towards the left and vanish ultimately. As soon as it vanishes, i want new frame with widgets to come sliding towards right. What should i do? Anticipating your suggestions and ideas.

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >