richieking 44 Master Poster

sockets got nothing to do with isb. look into pyserials ok?

richieking 44 Master Poster

Another way

d = '1/2/2010'.split('/')[-1]
'2010'
richieking 44 Master Poster

That says the dragon

richieking 44 Master Poster

add some check to name.

if (name.empty()){
 cout <<"You entered nothing..."<<endl;
}
richieking 44 Master Poster

indent the second loop ;)

richieking 44 Master Poster

yep you got it.

richieking 44 Master Poster

please put your code in the code tags

richieking 44 Master Poster
print(["/".join(date.split("-"))])

2011/03/03

from my htc phone ;)

richieking 44 Master Poster

can you post again your code in the code tags please.

richieking 44 Master Poster

;)

import socket
socket.socket()

happy?

richieking 44 Master Poster

happ for you. You can mark the thread as solved.

richieking 44 Master Poster

1. The logic of writting only to row will not help you.
you need to provide to collumn info too.

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: 
    # separate fields by commas 
    #L = line.strip()
    L = list(line)
    sheet.write(row,col,L) ## basic logic    
    row += 1
    col +=1 ## you need this i think
wbk.save('reformatted.data.xls')

You must be ok i think ;)

and try csv files for excell . They just work!

richieking 44 Master Poster

canyvr i think tonyjv's link got a cooked dinner for you ;)

richieking 44 Master Poster

Just added tips ;)

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())
richieking 44 Master Poster

Use the rectangle x,y cordinates for your bitmap cordinates. simple

richieking 44 Master Poster

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.

def dppend(self)
   
  self.dogApp=[]
  self.dogApp.append((self.name,self.breed))
  return self.dogApp

Then call it like this

dogs= Dog(dogname,dogbreed)
dogs.dappend()
richieking 44 Master Poster

Dlink router or what?

richieking 44 Master Poster

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 menu level navigation class. (And action of any kind) etc

Draw you thinking on paper first, have a working idea before you even try to hit your keyboard.
Adios !

richieking 44 Master Poster

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

richieking 44 Master Poster

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.

richieking 44 Master Poster
assert type(number) == int

But if you want to increment number. Number is already int type.

richieking 44 Master Poster

Well Gris has cooked the food well enough for you. :)

richieking 44 Master Poster

You're kidding, right? What is the Total, Average, and Mean of a list of names? :icon_rolleyes:

mmm WaltP are you following the show??

richieking 44 Master Poster

Here you go duddy :)

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!
richieking 44 Master Poster

Look first dont pass arg to the 2 functions by ref.

You misuse the ref. calls in the functions. You over write the memory

beta = new_degrees;

and alpha's ref. is never used.

Forget about ref. for not ok? Just get the grip first.

richieking 44 Master Poster

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 be data truncation.

WaltP commented: Students are not allowed to "look int vectors" until the instructor teaches them. -3
richieking 44 Master Poster

Do this........

c.execute('UPDATE objects SET created=?,modified=? WHERE id=?',
        (data1,data2,data3))
richieking 44 Master Poster

Cast to string...
you need to cast it to string like this...

getRow = "// " + str(ligne[0]) + " " + str(ligne[2]) + "\n\n" + str(ligne[1])

And you are ready to go
:)

richieking 44 Master Poster

under normal python way of sqlite select.... This should do.
The easier way.

c.execute('select titre, code, date from codes where id=?',idrow )

That is it :)

richieking 44 Master Poster

acehigher where did you get the above code from?

richieking 44 Master Poster

spot on snippsat

richieking 44 Master Poster

Try set.
Look into set module. its very simple.
:)

richieking 44 Master Poster

how much are you planing to spend on that.??
$???
I need the drive :)

richieking 44 Master Poster

yea

def main()

it inactive..

richieking 44 Master Poster

Slate Every data is a candidate for database insertion.
Data does not have to be in some sort of order. You do that job.

Aftert all that is what programing is all about. ;)

richieking 44 Master Poster

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

richieking 44 Master Poster

well if you are happy with my help. Then try and upvote me a lil ok?
Thanks and happy coding :)

richieking 44 Master Poster

what do you mean by list command?
Normally, ftp client will read the data of the connected address in a list form.... is that what you want?

richieking 44 Master Poster

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

richieking 44 Master Poster

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

richieking 44 Master Poster

why dont you only read the lines into a list and slize it???

The increment the index to get what you want?

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

something like this. coming from my HTC fone.
hope you get the idea

BirdaoGwra commented: I solved my problem bcos of his help +2
richieking 44 Master Poster

Can you please post the part of your code where you think you have errors?

I hate long codes :)

richieking 44 Master Poster

tk tk.... what about wx????

richieking 44 Master Poster

can you post your code so far. :)

richieking 44 Master Poster

copy and run my code. you should be ok with that.

richieking 44 Master Poster

Yep line 36.
Assignment operator needed not comparism.

monthN = "Decemeber";

instead

richieking 44 Master Poster

Try this .........

#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 - lowerBound;
	 guess = upperBound - (rand() % range);
	 cout << "Is your number?    " << guess << "  (l/h/y)   " << endl;
	 cin >> ans;

	 // is devidving by zero because the range is zero so must use else statement if range equals then we know the ans
	 // then output the ans------where do i put it then

	 //if anewers is l
	 if(range ==0){
		 done = true;
	 }
	 if (ans == 'l')
		{
	        upperBound = guess - 1;
			done = false;
			cin.get();
	    }

	// started trying  to select option for h ansewer
	 if (ans == 'h')
	    {
		   lowerBound = guess + 1;
		   done = false;
		   cin.get();
	    }

	 //started trying if ans inputed y
	 if (ans == 'y')
	   {
		cout << "yes!!!! i got it.   " << endl;
		done = true;


		cout << "do you want to play again? (y/n)" << endl;
		cin >> ans;

			if (ans == 'n')
			 {
				done = true;
			 }


			if ( ans == 'y')
			 {
				done = false;
			 }

		}

  count++;

 }while (!done);


cout << "Number of execution is " << count++ << " Times \n";
cout <<"Programme terminated \n";
cin.get();
return 0;
}
richieking 44 Master Poster

try this.........

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 = "May";
	if(highestMonthName == 5)
		monthN = "June";
	if(highestMonthName == 6)
		monthN = "July";
	if(highestMonthName == 7)
		monthN = "August";
	if(highestMonthName == 8)
		monthN = "September";
	if(highestMonthName == 9)
		monthN = "October";
	if(highestMonthName == 10)
		monthN = "November";
	if(highestMonthName == 11)
		monthN == "Decemeber";

	return monthN;
}
}
richieking 44 Master Poster

I hate long file.............oopsss !

richieking 44 Master Poster

nice one Jay :)