611 Posted Topics

Member Avatar for kur3k
Member Avatar for kur3k
0
864
Member Avatar for prateekmeharia
Member Avatar for appsrox

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 …

Member Avatar for richieking
0
951
Member Avatar for Python_nooby
Member Avatar for jamseyjames
Member Avatar for richieking
0
83
Member Avatar for amanmazleigh
Member Avatar for sheennave
Member Avatar for Razzo1

add some check to name.[CODE] if (name.empty()){ cout <<"You entered nothing..."<<endl; }[/CODE]

Member Avatar for mike_2000_17
0
2K
Member Avatar for rssk

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.

Member Avatar for rssk
0
80
Member Avatar for toritza
Member Avatar for Tinee

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.

Member Avatar for Dingbats
0
226
Member Avatar for fsl4faisal
Member Avatar for stan2000
Member Avatar for Arbus
0
154
Member Avatar for joeywheels

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 …

Member Avatar for woooee
0
153
Member Avatar for canyvr
Member Avatar for woooee
0
128
Member Avatar for tcl76

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: …

Member Avatar for tcl76
0
2K
Member Avatar for BirdaoGwra
Member Avatar for richieking
0
164
Member Avatar for Thristan_

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]

Member Avatar for richieking
0
421
Member Avatar for Boubakr

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 …

Member Avatar for Boubakr
0
117
Member Avatar for hughesadam_87

Nice stuff but what is the benefit of this app. In real life situation? Can you give more light?

Member Avatar for Gribouillis
0
162
Member Avatar for flebber
Member Avatar for snippsat
0
2K
Member Avatar for maniac00

[CODE]assert type(number) == int[/CODE] But if you want to increment number. Number is already int type.

Member Avatar for Gribouillis
0
123
Member Avatar for Awesumlewy

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 …

Member Avatar for richieking
0
173
Member Avatar for stefh

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 :)

Member Avatar for stefh
0
666
Member Avatar for Thropian

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]

Member Avatar for TrustyTony
0
118
Member Avatar for Greyhelm

Do this........ [CODE] c.execute('UPDATE objects SET created=?,modified=? WHERE id=?', (data1,data2,data3)) [/CODE]

Member Avatar for richieking
0
5K
Member Avatar for acehigher

[B][COLOR="Green"]acehigher[/COLOR][/B] where did you get the above code from?

Member Avatar for Gribouillis
0
103
Member Avatar for debasishgang7
Member Avatar for l00kit

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?

Member Avatar for l00kit
0
254
Member Avatar for ksmakkapawee
Member Avatar for Viasur
Member Avatar for richieking
0
147
Member Avatar for kinto
Member Avatar for nosehat

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!.

Member Avatar for richieking
0
4K
Member Avatar for rawrxiv

And dont forget to do before complain python idea..... Always use try and catch for streams . :)

Member Avatar for richieking
0
144
Member Avatar for BirdaoGwra

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] …

Member Avatar for richieking
0
203
Member Avatar for HelloPeople1

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?.

Member Avatar for slate
0
112
Member Avatar for lgonzo

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 …

Member Avatar for lgonzo
0
109
Member Avatar for Python_nooby
Member Avatar for da10x

Can you please post the part of your code where you think you have errors? I hate long codes :)

Member Avatar for richieking
0
1K
Member Avatar for vinayj85
Member Avatar for alex55

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 = …

Member Avatar for alex55
0
124
Member Avatar for fugmag

And note that .project is a hidden file. you need to turn on view hidden file to see it ok? :)

Member Avatar for fugmag
0
72
Member Avatar for Beat_Slayer

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 :)

Member Avatar for gleam.uahmed
0
1K
Member Avatar for Alex.
Member Avatar for DecreaseEntropy

Go here for what you need[URL="http://pyqrcode.sourceforge.net/"]http://pyqrcode.sourceforge.net/[/URL]

Member Avatar for katmai539
0
176
Member Avatar for rssk

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 …

Member Avatar for rssk
0
176
Member Avatar for acrocephalus

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...

Member Avatar for richieking
0
154
Member Avatar for mca3

Do this.... [CODE] cursor.execute("INSERT INTO main12 VALUES(?,?)",(self.temp,self.entry2)) [/CODE]

Member Avatar for richieking
0
76
Member Avatar for akshayreddy

We are here to help with the homework . You just show a little effort and you are done. :)

Member Avatar for TrustyTony
0
257
Member Avatar for zizuno

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. :)

Member Avatar for richieking
0
614

The End.