Response codes and \r\n
Heya, I am reading an XML file (code at the end if it helps) and all goes well except I am getting the http response code printed. So everything (hat works of course) has 200 OK on the first line. Am I missing some simple way of surprising this, or should I just delete the 1st line before playing with the content? Also everything I get has \r\n in it, which atm I am getting rid of with strip(), is that the best way? http://pastebin.com/m4120242 Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. you need to open a dos prompt before doing the steps above. Go to start-run and hit cmd enter without the quotes. -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
W. eWatson wrote: Catherine Heathcote wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. you need to open a dos prompt before doing the steps above. Go to start-run and hit cmd enter without the quotes. Something is amiss here. There's the MS Command Prompt, which I'm looking at right now. Yes, it has cd, and so on. I'm also looking at the Python command line window. It allow one to run interactively. If I write a simple python program with just raw_input, by clicking on the file name, I get a window with the the title \Python25\pythonexe that shows the prompt. If I deliberately put a syntax error in the program, and run it by clicking the file, then A window appears and disappears so quickly that I have no idea what it said. How do I keep that window up? Which, if any, of these is the real Python console? What is the window called in the example I gave with raw_input? Run the program from within the MS command line, not by double clicking it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
W. eWatson wrote: Catherine Heathcote wrote: W. eWatson wrote: Catherine Heathcote wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. you need to open a dos prompt before doing the steps above. Go to start-run and hit cmd enter without the quotes. Something is amiss here. There's the MS Command Prompt, which I'm looking at right now. Yes, it has cd, and so on. I'm also looking at the Python command line window. It allow one to run interactively. If I write a simple python program with just raw_input, by clicking on the file name, I get a window with the the title \Python25\pythonexe that shows the prompt. If I deliberately put a syntax error in the program, and run it by clicking the file, then A window appears and disappears so quickly that I have no idea what it said. How do I keep that window up? Which, if any, of these is the real Python console? What is the window called in the example I gave with raw_input? Run the program from within the MS command line, not by double clicking it. Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS commands. I get to drill my way down 4 levels of folders. What DOS cmd allows one to list only folders? Still, why would one design a window that disappears, when it has useful data in it? I see that if I click on the window, it has properties, width, height, etc. Thats programming. Whaterver the language, you will need to be comfortable with the CLI of your operating system. -- http://mail.python.org/mailman/listinfo/python-list
Embarrasing questio
But I just cant find it. How do I do an or, as in c/c++'s ||? Just trying to do something simple, the python equivilent of: if(i % 3 == 0 || i % 5 == 0) Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Embarrasing questio
TechieInsights wrote: On Feb 12, 9:03 am, Catherine Heathcote catherine.heathc...@gmail.com wrote: But I just cant find it. How do I do an or, as in c/c++'s ||? Just trying to do something simple, the python equivilent of: if(i % 3 == 0 || i % 5 == 0) Thanks. if i % 3 == 0 or i % 5 == 0 Yea, new it would be embarrasing, thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Embarrasing questio
Aahz wrote: In article zkxkl.34048$sp5.7...@text.news.virginmedia.com, Catherine Heathcote catherine.heathc...@gmail.com wrote: But I just cant find it. How do I do an or, as in c/c++'s ||? Just trying to do something simple, the python equivilent of: if(i % 3 == 0 || i % 5 == 0) if i % 3 == 0 or i % 5 == 0: You may find it worthwhile to quickly step through everything in the standard Python tutorial, it covers lots of stuff like this. I did, though perhapse a little to quickly! lol -- http://mail.python.org/mailman/listinfo/python-list
Couple of noobish question
Firstly hi, I don't know any of you yet but am picking up Python and will be lurking here a lot lol. I am a hobbiest coder (did 3 out of 4 years of a comp tech degree, long story) and am learning Python, 'cos I saw some code and it just looks a really nice language to work with. I come from C++, so I am bound to trip up trying to do things the wrong way! I have been working with Project Euler to get the hang of Python, and all goes well. I have an idea for a small project, an overly simplistic interactive fiction engine (well more like those old choose your own adventure books, used to love those!) that uses XML for its map files. The main issues I see so far is the XML parsing (I should pick that up ok, I have a blackbelt in google-foo), but more importantly splitting code files. In C++ I would obviously split .cpp and .h files, pairing them up and using #include. How do I do this in Python? I see that you don't tend to split logic from defenition, but how do I keep different classes in different files? My google-fu fails me so far. -- http://mail.python.org/mailman/listinfo/python-list
Re: Couple of noobish question
Mike Driscoll wrote: On Feb 4, 10:47 am, Catherine Heathcote catherine.heathc...@gmail.com wrote: Firstly hi, I don't know any of you yet but am picking up Python and will be lurking here a lot lol. I am a hobbiest coder (did 3 out of 4 years of a comp tech degree, long story) and am learning Python, 'cos I saw some code and it just looks a really nice language to work with. I come from C++, so I am bound to trip up trying to do things the wrong way! I have been working with Project Euler to get the hang of Python, and all goes well. I have an idea for a small project, an overly simplistic interactive fiction engine (well more like those old choose your own adventure books, used to love those!) that uses XML for its map files. The main issues I see so far is the XML parsing (I should pick that up ok, I have a blackbelt in google-foo), but more importantly splitting code files. In C++ I would obviously split .cpp and .h files, pairing them up and using #include. How do I do this in Python? I see that you don't tend to split logic from defenition, but how do I keep different classes in different files? My google-fu fails me so far. You just use the keyword import. Here's a goofy example: 1) foo.py contains a class called Foo 2) bar.py contains a script that imports Foo: import foo # create an instance of the Foo class myFoo = foo.Foo() I hope that was clear. Mike Perfect, thanks ^^ -- http://mail.python.org/mailman/listinfo/python-list
Re: what IDE is the best to write python?
Tim Rowe wrote: 2009/2/3 Jervis Whitley jervi...@gmail.com: real programmers use ed. Ed? Eee, tha' were lucky. We had to make holes in Hollerith cards wi' our bare teeth... You had teeth!?! Oh and hi, I shall be a new face in the crowd ;) -- http://mail.python.org/mailman/listinfo/python-list
Question about inheritence
If I create a new class inherited from another with a constructor, what happens with the new class's constructer? Thanks for your time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about inheritence
On Tue, 22 Jul 2008 09:35:58 -0700, Matimus wrote: On Jul 22, 9:26 am, Catherine Heathcote [EMAIL PROTECTED] wrote: If I create a new class inherited from another with a constructor, what happens with the new class's constructer? Thanks for your time. Nothing, unless you call it in your constructor. class Base(object): def __init__(self): print Base constructor called # without calling the base class constructor class C(Base): def __init__(self): print C constructor called # call the base class constructor using super class D(Base): def __init__(self): super(D, self).__init__() print D constructor called c = C() d = D() Matt Aha! Makes sence, thankyou. As you can probably tell I am new to Python, but not programming as a whole. -- http://mail.python.org/mailman/listinfo/python-list