- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 17
- Posts with Upvotes
- 15
- Upvoting Members
- 7
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 4
Re:
Hi I have some python file.i runs these file one by one as below on unix server. python f4761sk3.py python f4761sk2.py python f4761sk1.py python f4761se3.py python f4761se2.py python f4761se1.py python f4761pl3.py python f4761pl2.py python f4761pl1.py python f4761no3.py python f4761no2.py python f4761no1.py python f4761nl3.py python f4761nl2.py python f4761nl1.py python f4761ie3.py python … |
|
[CODE]# -*- coding: utf-8 -*- from PyQt4 import QtGui from PyQt4.QtCore import * import sys import os class VideosToMp3(QtGui.QWidget): def __init__(self, parent = None): super(VideosToMp3, self).__init__(parent) ''' Labels and GUI ''' extension = QtGui.QWidget() download_label = QtGui.QLabel("Enter YouTube video URL:") self.download_line_edit = QtGui.QLineEdit() file_label = QtGui.QLabel("Enter file name (optional):") self.file_line_edit … |
|
Re:
The idea of this thread is to help the beginning Python programmer with hints and helpful code. Please feel free to contribute! If you have any questions start your own thread! The creators of Python are very active, improving the language all the time. Here is a little of the … |
|
Re:
This 'sticky' thread is for working examples of Python GUI code. Note that most wxPython examples have their own thread. Please use comments in your code to help the reader. The example code should be usable as a template, so folks get a feel for the toolkit and can use … |
|
Re:
Early versions of Python used a hybrid of samplesort (a variant of quicksort with large sample size) and binary insertion sort as the built-in sorting algorithm. This proved to be somewhat unstable, and was replaced in version 2.3 with an adaptive mergesort algorithm. I am comparing several rudimentary sorting routines, … |
|
Re:
Hi, It is my code: [CODE]mylist = [['fiss','giss'], ['e','h'], ['d','u'], ['c','t'], ['b','o'], ['a','z']] for alist in mylist: g = ' '.join(alist) print g f = open("write.txt", "w") f.write(g) f.close()[/CODE] How will I write all the words in the txt file. it is only writing the last line of the file. … |
|
Re:
THis is program in java for First 100 Prime Number as "count<100" . public class PrimeNumber { public static void main(String args[]) { int num=4; int count=0; System.out.println("First 100 Prime Number is: "); System.out.println("1"); System.out.println("2"); System.out.println("3"); while(count<100) { num++; if(num%2!=0) { int dv=3; while((num%dv!=0)&&(dv<=((num-1)/2))) { dv++; } if(num%dv!=0) { count++; … |
|
Re:
Could someone explain to me why this code will not print the 10th prime number? It says there is a syntax error on the fourth line (the x = range(3, math.sqrt(test_num)). It also says there is a syntax error on the sixth line (while prime_count < 10:). [code]import math test_num … |
|
Re:
Hello, I have a to make a class called fibonacci. This is what is given to us : fibonacci(0)=1 fibonacci(1)=1 fibonacci(n)= fibonacci(n-Â1)+fibonacci(n–2) Below is an example of running the fibonacci class as an input of 6. The output is: fibo(0)=1 fibo(1)=1 fibo(2)=2 fibo(3)=3 fibo(4)=5 fibo(5)=8 fibo(6)=13 [B]My code is:[/B] [CODE] … |
|
Re:
I need help with a py generated file that was made in QT. I use the following line [CODE]QtGui.QTabWidget.addTab(self.tabWidget, QtGui.qApp.tr("New Tab"))[/CODE] and get this error [CODE]Traceback (most recent call last): File "C:\python\mainwindow2.py", line 349, in createInvoice QtGui.QTabWidget.addTab(self.tabWidget, QtGui.qApp.tr("New Tab")) TypeError: arguments did not match any overloaded call: QTabWidget.addTab(QWidget, QString): argument … |
|
Re:
Hi, This is my first post.I found interesting thing while playing with lists. [CODE]l = ['asd',"asd'das",'qw','213'] print "original list:", l print "first item:", l.pop(0) print "second item:", l.pop(1) print "modified list:", l [/CODE] [B]output:[/B] original list: ['asd', "asd'das", 'qw', '213'] first item: asd second item: qw modified list: ["asd'das", '213'] … |
|
Re:
So I'm new to python, although not terribly new to programming. I am going through some tutorials, but am having some trouble. I am trying to execute a program from the python shell (using Python 3.1). Right now, I have the >>> prompt. I can't seem to get any program … |
|
Re:
Hi, I have generated an array of random numbers and I'm trying to then write this array to a .txt file but the code I have written doesn't seem to do this correctly. Any help on this would be great. Here is what I have so far: import numpy as … |
|
Re:
I'm just trying to come thru with a passing grade at this point because there was no instruction. I can't even get the program that was given to me to work, even though I copied it verbatim from the text. Please help me figure out what the error is so … |
|
Re:
This program allows one to use many different sorting algorithms to sort an iterable. [code=python] from time import* from random import* #GNOME SORT def gnome_sort(lst): pos = 1 while pos < len(lst): if lst[pos] >= lst[pos-1]: pos = pos+1 else: temp = lst[pos] lst[pos] = lst[pos-1] lst[pos-1] = temp if … |
|
Re:
[code] # nth_prime.py def nth_prime(n): primes = [2] test_int = 1 while len(primes) < n: test_int += 2 for p in primes: if test_int % p is 0: break else: if p is primes[len(primes)]: primes.add(test_int) return primes[n - 1] while True: try: num = int(input("Enter a number:\n")) print(nth_prime(num)) except ValueError: … |
|
Re:
Hey guys can you help me convert this code into java... i started a little... [CODE] def  minEditDistR(target, source):   """ Minimum edit distance. Straight from the recurrence. """   i = len(target); j = len(source)   if i == 0:  return j   elif j == 0: return i … |
|
Re:
Trying to call the gcd from the constructor but I keep getting either a global error or gcd is not defined error. Any suggestions? The program is supposed to reduce fractions immediately. So I got rid of the add. [CODE]class Fraction: def __init__(self,m,n): self.num = m self.den = n gcd() … |
|
Hei, I tried to find "dynamic programming" algorithms in Python. If anyone has examples of what it means a dynamic programming, it's would be nice. (Please not post Wikipedia links). Google -> c++, java and other, not Python. Thanks! |
|
Re:
Hi. I have an external file where I have the results of a dictionary: [CODE]google.com {'facebook.com': 230, 'yahoo.com': 9, 'fifa.org': 67, 'msn.com': 3} yahoo.com {'apps.facebook.com': 13, 'msn.com': 9, 'myp2p.eu': 2} [/CODE] The results show the search engines, the links have been clicked from the search engine and the number of … |
|
Re:
Hi... I want ti contril the while loop, just make it looping just for x times, ex: loop for 5 times and pass to the next code :) |
|
Re:
Dear All, I am a total newbie to Python and programming in general. I know I'd find more materials for Python2, but Python3 was a reflected choice. That said, I have gone trough: [URL="http://www.daniweb.com/forums/thread173960-2.html"]http://www.daniweb.com/forums/thread173960-2.html[/URL] and tried to assemble my spell checker, and ended up with the following code: [CODE]#!/usr/bin/python3 # … |
|
Re:
hi all......... a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6 c1 c2 c3 c4 c5 c6 d1 d2 d3 d4 d5 d6 i want to select a column and i need a output like a1 a4 b1 b4 c1 c4 d1 d4 |
|
[CODE]from copy import deepcopy sis = file("teedtest.01.sis", "r") val = file("rp.val", "wt") N, K = map(int, sis.readline().strip().split()) alist = [] for i in range(0, K): t = [] for i in range(0, K): t.append(0) alist.append(t) for i in range(K): a, b, c = map(int, sis.readline().strip().split()) alist[a][b] = alist[b][a] = c … |
|
Re:
I want to solve this problem. [QUOTE]There are 52735727364727372 students and 2889221271829121 teachers in a school . On children's day each teacher brings x toffees with him/her . All the toffees are collected and distributed equally to all the students . At the end it was found that there was … |
|
Re:
Hello ,I want to find between what numbers of a list exist a specific number: For example if i enter 15,i should be between 13 and 21. [code] list = [1,5,9,11,13,21,27,29,32] for index in range(len(list)): if num > list[index] and num < list[index + 1]: ............................................... [/code] But with this … |
|
Re:
how to use file open ...... i want to read 1.process memory usage 2.cpu memory usage 3.free memory usage thanks in advance |
|
[CODE]sis = file("file.sis", "r") val = file("file.val", "wt") n = int(sis.readline().strip()) la = sis.readline().strip() alist = [] for i in xrange(n): line = sis.readline().strip() alist.append(line.split()) for i in xrange(n): print map(int, alist[i][0].split(":")), map(int, alist[i][1].split(":")) [/CODE] In: [CODE] 07:34 08:55 10 20 08:25 09:00 10 20 [/CODE] Out: [CODE] 08:25 09:00 … |
|
Re:
[B]Hi, I am beginner in Python and I'm looking for a method to write to a file by using Index. This is my program:[/B] ************************************************************** infile = open("land1.txt","r") outfile = open('out.txt', 'w') text = infile.read() infile.close() search = "<CgPoint" found=text.find(search) while found > -1: print search, "found at location", found … |
|
Re:
Hello :) I'm from Brazil, so sorry about my english. This is the first code I post here - I'm a begginer in Python. It is a function to calculate determinants of matrices. You can attach it to a class if you wish. Please leave a comment if you wish … |