15,193 Topics

Member Avatar for
Member Avatar for james.lu.75491856

THIS IS DANGEROOUS CODE, if it fails, it may prevent yu frome editing it. also, you can use the functions to do crazy stuff. Look at [this refrence](http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx) and change the `0x12` to what you want. (This one hold alt, so typing r will actibvate the menu that starts with …

Member Avatar for sneekula
-4
363
Member Avatar for turbo22

Ok, i've gotten pretty far on a code but keep getting an error. I know it's something simple but i just can't put my finger on it please help. import os import pickle class Student(object): def _init_(self): self._students = {} def addStudent(self, name): self._students[name] = [0, 0, 0] def editStuData(self): …

Member Avatar for BearofNH
0
1K
Member Avatar for vegaseat

Shows you how to create multiple Tkinter buttons in a loop, each with its own name, label and command response.

Member Avatar for CodingCabbage
2
1K
Member Avatar for chophouse

Need help understanding this error, and how to eliminate it. Using Python 3.3. I'm trying to define a function that takes two arguments and then constructs the proper arguments for a call to the ftblib.storbinary method. Here's my code: from ftplib import FTP_TLS ftps = FTP_TLS('xxxxxx', user='xxxx', passwd='xxxx') ftps.prot_p() ftps.set_pasv(False) …

Member Avatar for chophouse
0
9K
Member Avatar for vegaseat

The code sample shows how to get an image from the internet and show it in a Tkinter label widget.

Member Avatar for Nils_1
4
2K
Member Avatar for lewashby

(Linux) `output = os.listdir()` In the above line of code I'm getting the name of the file(s) in a given directory, but how can I also get the permissions? This is what I want to see. -rwxr-xr-x 1 garrett garrett 158 Nov 23 10:49 dirlist.py drwxr-xr-x 2 garrett garrett 4096 …

Member Avatar for lewashby
0
148
Member Avatar for chophouse

I'm writing a script to automatically up load a file from Server A to FTP server B. I'm getting stuck at the connecting part. I can connect with a python script using regular FTP, and have done so, but when trying to implement a SSL connection, I keep getting a …

Member Avatar for chophouse
0
3K
Member Avatar for Crazyscript77

Hi all, just wondering if someone could help me out with a small loop question. If I had an input field in a GUI which writes to variable "counter" (a numerical value), how would I be able to use this value to control the amount of times a loop is …

Member Avatar for Crazyscript77
0
186
Member Avatar for krystosan

I have a function in which i want to mock `os.listdir` that returns directory content to variable `dirContent` def setUp(self): self._filePaths = ["/test/file/path"] self.mox = mox.Mox() def imageFilePaths(paths): imagesWithPath = [] for _path in paths: try: dirContent = os.listdir(_path) except OSError: raise OSError("Provided path '%s' doesn't exists." % _path) for …

0
141
Member Avatar for Py New BB

Hello all, by using Python, i want to pickup the news titles on http://www.boston.com/yourtown/ and save them into a .txt file. i have 2 questions: 1. how can i have the codes run every 2 hours? 2. how can i have the outputs write into a .txt file? thanks. from …

Member Avatar for snippsat
0
164
Member Avatar for nouth

for example I don't know what this is called » `[('cat', 'meow'), ('dog', 'ruff')]` if I try `for l in [('cat', 'meow'), ('dog', 'ruff')]: print l` I am using l for lady luck lucy not I for I or the number 1 + maybe even | pipe for smoking it …

Member Avatar for vegaseat
0
248
Member Avatar for RAJESH.M

hello sir, my work is run version.sh file and collect the values of version and type in the output. i have around 500 servers,so i want to automate this process using pyhton. i had written sample code shown below, but it is not giving good results.will you please help me …

Member Avatar for rrashkin
0
172
Member Avatar for lewashby

#!/usr/bin/python3 import sys input1 = sys.argv[1] def print_params(*params): print(params) print_params(input1) #END# In the above code how can I call all the command line arguments with the prin_params function without having to code input1, input2, input3, etc... When I'm doing testing liket this I would like to be able to just …

Member Avatar for vegaseat
0
235
Member Avatar for johnny_disco

Hi All, I am trying to scrape a piece of HTML similar to the below where I want beautiful soup to return something like: List Price, £28,410 Body Style, Open Car etc etc. I thought if I did this: soup = BeautifulSoup(html_doc) tag = soup.find_all('tr') tag_td = tag[0].find('td') tag_b = …

Member Avatar for BearofNH
0
226
Member Avatar for Yarynka

I'm curious.. is it possible to extend the context of the word "monstrous" in concordance so we have: >>> text1.concordance("monstrous") Building index... Displaying 11 of 11 matches: ong the former , one was of a most monstrous size . ... This came towards us , ON OF THE PSALMS . …

Member Avatar for Yarynka
0
106
Member Avatar for Iceman10284

Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and the display the following data: • The lowest number in the array • The highest number in the array • The total of the numbers in …

Member Avatar for booicu
-1
7K
Member Avatar for Waseemaburakia

I'm trying to modify a Bibblesort code I'm writing that will count the number of instances and print out a seperate line for each instance and how many occurances it had. def BubbleSortList(MyList): ComparisonCounter = 0 for j in range ( len(MyList)): for i in range ( len(MyList)-1-j ): if …

Member Avatar for Waseemaburakia
0
294
Member Avatar for sinnebril

Hi, I'm trying to teach myself the Python language with the Google Python class ([url]http://code.google.com/edu/languages/google-python-class/set-up.html[/url]). With the exercise 'wordcount' I get a Traceback error (with the main function and sys.exit(1) function). Even with the solution script (as displayed here). Does anyone recognize this problem and can some one tell me …

Member Avatar for vegaseat
0
992
Member Avatar for krystosan

How do I rotate image in this code every n seconds http://pastebin.com/SKDzuC15 lets say i want to change the image in pixmap after 5 seconds to next image, what is happening right now the last one gets displayed.

Member Avatar for krystosan
0
267
Member Avatar for Stefano Mtangoo

I started this for any information on new python modules apart from standard library. Many people (Including me), aren't willing to move into p3k due to lack of external/non-standard modules. So I started this to keep ourselves informed on New Python 3 Modules. No Limitation, ANY PYTHON 3 MODULE

Member Avatar for vegaseat
0
983
Member Avatar for stevewilliams02

I need help with the button action for this code. When you click on the button, a new window should open with the GIF image of the horoscope sign. The name of the GIF image files are "Pisces.gif", "Taurus.gif",etc. from Tkinter import * #Call all modules for TKinter in order …

Member Avatar for sneekula
0
191
Member Avatar for vegaseat
Member Avatar for robert99x

Programming Python 3rd Edition by Mark Lutz has example code (below) where a variable seems to be assigned with options ("or") but what the criteria for selecting the options is not clear. The explanation is almost non-existent but I think this is to do with feeding in a variable number …

Member Avatar for robert99x
0
291
Member Avatar for Pioggia254

Hello! I am a newbe to python and apologize in advance for this question, because I am sure it is an easy fix that I am oblivious too - I wrote this simple program for a guessing game- very basic, which is fine - but when you get to the …

Member Avatar for vegaseat
0
173
Member Avatar for vinodvinu

Hi there, I am a newbie in programming. Python is my choice. because it is easy to learn. But the Tkinter GUI making is horiible. I don't like to write code for GUI. I like the visual basic method. So i installed Qt Designer. But i don't know how to …

Member Avatar for vegaseat
0
443
Member Avatar for flebber

Maybe a list comprehsnion is not the right way to go here. I want to define a nested list that a user can tell how many lists and how many entries in each subllist. Then have random call a value for each entry in the sublist, working on unique entries …

Member Avatar for TrustyTony
0
236
Member Avatar for XodoX

I'm new to Python, but I can use a library to do this, right? Like this one: import pprint import scipy import scipy.linalg # SciPy Linear Algebra Library A = scipy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ]) P, L, …

Member Avatar for Gribouillis
0
2K
Member Avatar for flebber

Hi I am struggling with assigning values to a list of a list. This is my full code. import random #get user input as to size of range range_size = 0 if range_size == 0: try: range_size = int(input('Size of Range?: ')) except ValueError: print('That was not an integer!') range_size …

Member Avatar for flebber
0
542
Member Avatar for bryann

Can someone please help me with this because it is driving me crazy. I wrote a program which prompts the user to enter a number I convert the string to an integer when i print the value it sometimes comes out as a decimal e.g. 3.0 I thought an integer …

Member Avatar for bryann
0
321
Member Avatar for gmill198

# This is my code for a space invaders-like game in pygame. How do I add a second enemy? # from pygame import * import random class Sprite: def __init__(self, xpos, ypos, filename): self.x = xpos self.y = ypos self.bitmap = image.load(filename) self.bitmap.set_colorkey((0,0,0)) def set_position(self, xpos, ypos): self.x = xpos …

0
73

The End.