- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 26
- Posts with Upvotes
- 21
- Upvoting Members
- 7
- Downvotes Received
- 6
- Posts with Downvotes
- 6
- Downvoting Members
- 6
Master's Degree in CS; Major in Automation Technology and Cybernetics; Passionate Pythoneer from the early days of Python; Former C++ nerd, but now clean.
- Interests
- making music, sci-fi
- PC Specs
- Python, Windows, Linux
Re:
I'm working on a cleanup script for tv shows that I download. Right now I'm just looking for a file greater than 50mb, but there should be a better way. [CODE] import os import shutil dir = "C:\Users\Bobe\Downloads\TV\\" for folder in os.listdir(dir): if os.path.isdir(os.path.join(dir,folder)): for file in os.listdir(dir + folder): … |
|
Re:
So.. Google are going ahead with their 'Go' programming language - "a cross between C++ and Python". [URL="http://bit.ly/4msbSJ"]Article[/URL] [URL="http://golang.org/"]Official site[/URL] Not sure what my thoughts are on it yet. What does everyone else make of it..? |
|
Re:
[B]!USING PYTHON 3.1![/B] [B]USING WINDOWS[/B] I never thought it could be so simple. However I should have clarified that it's a [B]1 character[/B] input. But the general idea is the same. Someone suggested that I explain what is going on better, so I'm going to do that. The function 'getch()' … |
|
Re:
A simple program to count the words, lines and sentences contained in a text file. The assumptions are made that words are separated by whitespaces, and sentences end with a period, question mark or exclamation mark. |
|
Re:
Hello Friends, I'm using PyQt 4.9... I want to have an IDE with code completion to work with Python and PyQt (since we are storing both the codes in a single file with .py extension).. Once i've tested eclipse and pydev plugin.. It was pretty good to work with.. Shall … |
|
Re:
I'm just wondering if it is possible to import a module as an object attribute. The basic description of what I want to accomplish is that I'm creating a software agent object. This agent will have a set of abilities (functions), but I don't know what these are ahead of … |
|
Re:
In the following program, I'M getting the following error message when I try to run it. [COLOR="Red"]TypeError: object.__new__() takes no parameters[/COLOR] [CODE] # Classy Critter # Demonstrates class attributes and static methods class Critter(object): """A virtual pet""" total = 0 def status(): print "\nThe total number of critters is", Critter.total … |
|
Re:
Completely frustrating - I have been googling for a solution for this for a couple of hours now. I have this little bit of code that I wish to read a text file into a Python Dictionary. I used this dictionary format internally within the another piece of code I … |
|
Re:
if i had a data file with html/xhtml tags: Code: <html> <head> <title> data file </title> </head> <body> <center><h1> heading 1 </h1></center> <b>bolded</b> <P>paragraph</P> <P> <br /> how would get a python program to read ONLY the start and end tags and and enqueue them in a queue? for example, … |
|
Re:
I cannot find one example of somebody doing this, only sorting by the first item. Here is my code: [CODE] dict.sort() for key in dict.keys(): print key, "%8s"% dict[key] [/CODE] I'm only getting an alphabetical sorting of the left side of the dictionary.. like this: a:4 c:3 b:12 a 4 … |
|
Re:
alright, so i'm trying to import text from a file into an array so that I have the ability to edit data, find certain functions, etc. This is currently what my program looks like....(I haven't gotten very far) from scipy import * from numpy import * def Radiograph_data: try: file('c:/users/ross/desktop/radiograph_data.txt') … |
|
Re:
How do I get my python code to compile one line at a time so I can see exactly how the code works. If anyone knows how to do this with Wing IDE that would also be helpful. Thanks. |
|
Re:
[code] class MyList(list): def __new__(cls, *p, **k): if not '_the_instance' in cls.__dict__: cls._the_instance = list.__new__(cls) return cls._the_instance def append(self, name): if name not in self: list.append(self, name) def extend(self, names): for name in names: if name in self: continue list.append(self, name) def remove(self, name): if name in self: list.remove(self, name) … |
|
Re:
I'm trying to write a program that will open a file named "data.dat". This file contains an unknown number of values that I need to have read and averaged together and is written such that each line has one value. I need to have the data in this file be … |
|
Re:
Hi all. I am very new at python and so i am having trouble with the simplest things, and i dont understand why this: newfile = raw_input('what do you want to name your new file?') text_file = open (newfile, "w") isn't working. Can somebody explain it? Thankyou |
|
Re:
Hi everybody, I'm trying to write a function that takes in 2 values, a min and a max, that prompts the user to enter a value within that range, and uses 0 as a sentinel to quit the loop. My issue is, I also want the loop to continue prompting … |
|
Re:
Hello. Here I go again. I tried to create a computer enemy for my connect 4 game: [CODE] def turn_comp(): import random print 'Computer ist am Zug!' playchip = random.randint(0, columns) board[0][playchip] = 'O' print_board() [/CODE] Even though I limited the range of randint with 0 and columns (in a … |
|
Re:
I am using BeautifulSoup for my project and I don't know how the object returned by the Soup is organized, so I don't know how to access it, except using only print I can only do this: [CODE]link = soup.find(attrs={'class' : re.compile("util2$")}) print link [/CODE] it print out the whole … |
|
PlugIns in their simplest form can be just python modules that are dropped into some designated directory and dynamically loaded by the main application. This snippet can be used to do just that. [B][U]Usage[/U][/B] To load plugin modules: [CODE]>>> plugins = importPluginModulesIn('mypackage') >>> plugins {'foo': <module 'foo' from 'mypackage\foo.py'>, 'bar': … |
|
Re:
Hi guys, Im a making a program where i need to be able to specify a folder and have my program import every module from that folder into my program... I was wondering how i would go about it. I can't use something like eval. But yeah, help would be … |
|
Re:
Hi I was wondering if someone could help me to figure out how to write a code for : Write a function print_table which consumes two parameters, a list of list of strings, and an integer for the length of the list. The function should print out the strings from … |
|
Re:
What would it take to make graphics show on the monitor without using stuff like tkinter and Qt? (tkinter and Qt are called toolkits right?) |
|
Re:
Hi all,I got a issue that how can I run several functions at same time? say [CODE] a=1 def function1(a) a+1 return a def function2(b) b+2 return b def plotGraph(a,b) return graph [/code] how can I just run plotGraph function here?..I am totally newb..hope anyone can help..thanks |
|
Re:
Hi, I don’t know if anyone would be able to help me with the following problem, I am hoping :D .. I have looked on the internet but no look. I have pickled a document into the pickle object, how can I now search the pickled object to remove a … |
|
|
Re:
Hi, i currently have these 2 files: [code] #!C:\Python26\python.exe #index.py print 'Content-type: text/html\n\n' print '<html><head>' print '<title>My Page</title>' print '</head><body>' print '<h1>Powers of two</h1>\n<ol>' print '<form action="sqr.py" method="post">' print '<label>How many numbers?</label>' print '<input type="text" name="b"/>' print '</ol></body></html>' [/code] and [code] #!C:\Python26\python.exe #sqr.py import cgi a = cgi.FieldStorage() b = … |
Re:
I'm new to this forum and to python in general, so be easy on me please. :icon_smile: I'm making a class to handle all events including mouse events. (I'm using pygame by the way) Heres how it looks so far: [CODE] class Event: #controlls all actions relating to events including … |
|
Re:
If I have a text file that contains strings and integers such as: Alabama 3200 Denver 4500 Chicago 3200 Atlanta 2000 what code could I use to print the smallest number (2000) after reading in that textfile. I know I first have to split the text so I'm just operating … |
|
Re:
I have written a script for scraping a web site, and it works fine. What does not work fine, is when I try to use the write function, to write the results to a txt-file. I am trying to run this: import BeautifulSoup, urllib2, re, time import codecs path='C:/Users/Me/Documents/Python' outfile=open(r'C:/Users/Steinar/Documents/Python/Vegvesen/vegresultat.txt', … |
|
This is one simple way to emulate a singleton class on behalf of a normal class. (A singleton class is a class with at most one instance.) The implementation does not emulate a class 100% (for example it lacks the special attributes lile __dict__ or __bases__), but it should be … |
|
Re:
I have a file of the following format: a 1 a 2 a 3 b 4 b 5 b 6 c 7 c 8 c 9 Here is my code: [CODE]def file_to_dict(fname): f = open("file.txt") d = {} for line in f: columns = line.split(" ") letters = columns[0] numbers … |