hello, for a small server program, I wanted to know which ports were
occuped.
with the dos command 'netstat'
so I tried this:
*>>>a=os.popen('netstat')*
*>>>bytes(a.read())*
but this occured in the second step:
*Traceback (most recent call last):*
* File "<pyshell#20>", line 1, in <module>*
* bytes(a.read())*
* File "C:\Apps\Programmation\Python3.2\lib\encodings\cp1252.py", line 23,
in decode*
* return codecs.charmap_decode(input,self.errors,…
[View More]decoding_table)[0]*
*UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 79:
character maps to <undefined>*
*how can I avoid it and why does the windows cmd does return an
undecodable character?*
*thank you.*
[View Less]
Rust language defines a special way to make an infinite loop (
http://doc.rust-lang.org/tutorial.html#loops).
I propose adding the same keyword to Python. It will be very useful for
WSGI servers and will suit as a more convenient replacement for recursion
(hence Python doesn't do TRE). I personally find it much prettier than *while
True* or *while 1*. It won't cause any problems with existing programs,
because *loop* is very rarely used as a variable name.
For instance
while True:
> …
[View More]do_something()
> do_something_else()
would turn to
loop:
> do_something()
> do_something_else()
[View Less]