611 Posted Topics
Re: can you make yourself more clearer? Post some code if possible ok? | |
Re: Try this c style [CODE]data_list = [ (1, 'Dave'), (234, 'Einstein'), (100000, 'Bob') ] print("Printing out to file 'test123.txt' ...") with open("test123.txt", "w")as fout: fout.write("".join(["%10d %30s \n"%(x[0],x[1]) for x in data_list])) print("".join(["%10d %30s \n"%(x[0],x[1]) for x in data_list])) ###output Printing out to file 'test123.txt' ... 1 Dave 234 Einstein 100000 … | |
Re: sockets got nothing to do with isb. look into pyserials ok? | |
Re: Another way [CODE]d = '1/2/2010'.split('/')[-1] '2010'[/CODE] | |
Re: And where do you get the servo module from?? self written? | |
Re: add some check to name.[CODE] if (name.empty()){ cout <<"You entered nothing..."<<endl; }[/CODE] | |
Re: A loop to do what? You must explain better. The best way to get people to assist you is how you ask your assistqance. At least you must provide enough information if you so care about your assistance. | |
Re: please put your code in the code tags | |
Re: Look first dont pass arg to the 2 functions by ref. You misuse the ref. calls in the functions. You over write the memory [CODE]beta = new_degrees;[/CODE] and alpha's ref. is never used. Forget about ref. for not ok? Just get the grip first. | |
Re: ;) [CODE]import socket socket.socket() [/CODE] happy? | |
Re: can you post again your code in the code tags please. | |
Re: You will need to include this def in your Dog class. The call it for appending Also it will be a good idea to make self.dogApp,self.name and self.breed global variable access in the class but should work like this anyway. [CODE] def dppend(self) self.dogApp=[] self.dogApp.append((self.name,self.breed)) return self.dogApp [/CODE] Then call … | |
Re: [B]canyvr[/B] i think tonyjv's link got a cooked dinner for you ;) | |
Re: 1. The logic of writting only to row will not help you. you need to provide to collumn info too. [CODE]import xlwt # Create workbook and worksheet wbk = xlwt.Workbook() sheet = wbk.add_sheet('python') row = 0 # row counter col=0 # col counter f = open('robert.txt') for line in f: … | |
Re: Use the rectangle x,y cordinates for your bitmap cordinates. simple | |
Re: Just added tips ;) [CODE]import os start = 'label' for fn in (f for f in os.listdir(os.curdir) if f.startswith(start) and os.path.isfile(f)): with open(fn) as fnFile: print(fnFile.read()) [/CODE] | |
Re: First you need a good organized class to control the menu levels. This shoud at least give you an idea. 1. You need the menu navigation class (a,b,c,d) etc menus 2. You need menu level navigation class inheriting the menu class. (Back,forward,up,down) etc 3. You need action class inheriting the … | |
Re: Nice stuff but what is the benefit of this app. In real life situation? Can you give more light? | |
Re: Well [B]Gris[/B] has cooked the food well enough for you. :) | |
Re: [CODE]assert type(number) == int[/CODE] But if you want to increment number. Number is already int type. | |
Re: Start looking into vector ok? its more flexible and a template. This mean you can extend your code to other data types. understand that 21.43 is a positive number. Well the compiler will save you from that but the user will not be happy with the result as there will … | |
Re: under normal python way of sqlite select.... This should do. The easier way. [CODE] c.execute('select titre, code, date from codes where id=?',idrow ) [/CODE] That is it :) | |
Re: Here you go duddy :) [CODE]dd= "this is a really long string that is completely pointless. But hey who cares!".split(" ") dd[0]='' print " ".join(dd) ##out is a really long string that is completely pointless. But hey who cares! [/CODE] | |
Re: Do this........ [CODE] c.execute('UPDATE objects SET created=?,modified=? WHERE id=?', (data1,data2,data3)) [/CODE] | |
Re: [B][COLOR="Green"]acehigher[/COLOR][/B] where did you get the above code from? | |
| |
Re: what do you mean by [B][COLOR="Green"]list command[/COLOR][/B]? Normally, ftp client will read the data of the connected address in a list form.... is that what you want? | |
Re: Try set. Look into set module. its very simple. :) | |
Re: how much are you planing to spend on that.?? $??? I need the drive :) | |
| |
Re: Well britanicus option is good for large files or an unknown size.Other than that... You just do it the easy way. Just readin and repalce what you need. Simple. :) But in the future use some organized data storage system. at least anydbm,pickle or sqlite my pick!. | |
Re: And dont forget to do before complain python idea..... Always use try and catch for streams . :) | |
Re: why dont you only read the lines into a list and slize it??? The increment the index to get what you want? [CODE] listc = [x.split() for x in f.readline()] ## now you get the data like ins =0 ins2 =0 for x in listc: print listc[ins:ins2+1],listc[ins+2:ins2+3] ins+=3 ins2+=4 [/CODE] … | |
Re: why dont you use a dict to save the name and scores? Then you can easy sort tham out. why not make your algo. very simple for yourself?. | |
Re: Try this .........[CODE]#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { srand(static_cast < unsigned int >(time(0))); int lowerBound = 1; int upperBound = 101; bool done = false; char ans; int count = 0; //bool found = true; do { int range; int guess; range = upperBound … | |
| |
Re: Can you please post the part of your code where you think you have errors? I hate long codes :) | |
Re: try this......... [code] string FindMax() { string monthN; for(int i=0; i<month; i++) { if(averagedMonth[i]>highestMonthName) { highestMonthName=i; } //gets the month name if(highestMonthName == 0) monthN = "January"; if(highestMonthName == 1) monthN = "February"; if(highestMonthName == 2) monthN = "March"; if(highestMonthName == 3) monthN = "April"; if(highestMonthName == 4) monthN = … | |
Re: And note that .project is a hidden file. you need to turn on view hidden file to see it ok? :) | |
Re: Simple transparent overlaying image [CODE]import Image handle = Image.open("fd.png")## Your first image file name handle.putalpha(30) handle.save("bv.png") df=Image.open("bv.png") dd =Image.open("i.jpg") ## Put your second image file name here df.paste(dd,(100,200)) df.save("gg.png")[/CODE] This is more simple :) | |
Re: Go here for what you need[URL="http://pyqrcode.sourceforge.net/"]http://pyqrcode.sourceforge.net/[/URL] | |
Re: Convert the list values to int/float data type. Then it will be easy to work with them. Eg.... [Code] Flist1 = [float(x) for x in f1] Flist2 =[float(x) for x in f2] [/Code] Now you can check for the diff. Btwn the lists. [Code] result = [] for x in … | |
Re: why would anyone wanna store an entire file content into a py object?? what about the size is about 4mb?? or 4gig?? Its just not a good idea. Can you explian further why you need that and maybe we can advice/help you with something more useful... | |
Re: Do this.... [CODE] cursor.execute("INSERT INTO main12 VALUES(?,?)",(self.temp,self.entry2)) [/CODE] | |
Re: We are here to help with the homework . You just show a little effort and you are done. :) | |
Re: Like snippsat said. If you need to parse html/php page you will need beautifulsoup or the hard way using regex. The choice is yours. :) |
The End.